home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / VISUALBA / BLTQ12.ZIP / CZ.HLP (.txt) < prev    next >
CZ Help  |  1993-01-04  |  218KB  |  3,875 lines

  1. CZ_HELP!
  2. INDEX
  3. TUTORIAL_INDEX
  4. LICENSE_AGREEMEN
  5. LICENSE_A
  6. PRODUCT_SUPPORT
  7. STARTING_CZ
  8. USING_CZ
  9. USING_CZ_A
  10. USING_CZ_B
  11. ABOUT_CZ
  12. IS_BULLET
  13. IS_A_DATABASE
  14. IS_DBF
  15. IS_A_BTREE
  16. IS_A_NETWORK
  17. IS_FILE_LOCKING
  18. IS_NLS
  19. DESIGN_A_DB
  20. CREATE_A_DB
  21. ADD_TO_THE_DB
  22. QUERY_THE_DB
  23. UPDATE_THE_DB
  24. DELETE_A_RECORD
  25. BC_COMPILE_WITH
  26. LIB_WITH
  27. MAKE_A_QLB
  28. LINK_WITH
  29. CALL_BULLET
  30. SPECS_OVERALL
  31. SPECS_DBF
  32. SPECS_DBF_A
  33. SPECS_DBF_B
  34. SPECS_DBF_C
  35. SPECS_INDEX
  36. SPECS_INDEX_A
  37. SPECS_INDEX_B
  38. SPECS_INDEX_C
  39. SPECS_MEMORY
  40. SPECS_MEMORY_A
  41. SPECS_OS_CALLS
  42. SPECS_LANGUAGES
  43. SPECS_OSES
  44. SPECS_NETWORKS
  45. SPECS_PERFORMANC
  46. SPECS_PERF_A
  47. SPECS_PERF_B
  48. SPECS_PERF_C
  49. SPECS_PERF_D
  50. INITXB
  51. EXITXB
  52. ATEXITXB
  53. MEMORYXB
  54. BREAKXB
  55. BACKUPFILEXB
  56. STATHANDLEXB
  57. GETEXTERRORXB
  58. DVMONCXB
  59. CREATEDXB
  60. OPENDXB
  61. CLOSEDXB
  62. STATDXB
  63. READDHXB
  64. FLUSHDHXB
  65. COPYDHXB
  66. ZAPDHXB
  67. CREATEKXB
  68. CREATEKXB_A
  69. CREATEKXB_B
  70. CREATEKXB_C
  71. CREATEKXB_D
  72. CREATEKXB_E
  73. CREATEKXB_F
  74. OPENKXB
  75. CLOSEKXB
  76. STATKXB
  77. READKHXB
  78. FLUSHKHXB
  79. COPYKHXB
  80. ZAPKHXB
  81. GETDESCRIPTORXB
  82. GETRECORDXB
  83. ADDRECORDXB
  84. UPDATERECORDXB
  85. DELETERECORDXB
  86. UNDELETERECORDXB
  87. PACKRECORDSXB
  88. FIRSTKEYXB
  89. EQUALKEYXB
  90. NEXTKEYXB
  91. PREVKEYXB
  92. LASTKEYXB
  93. STOREKEYXB
  94. DELETEKEYXB
  95. BUILDKEYXB
  96. CURRENTKEYXB
  97. GETFIRSTXB
  98. GETEQUALXB
  99. GETNEXTXB
  100. GETPREVXB
  101. GETLASTXB
  102. INSERTXB
  103. UPDATEXB
  104. REINDEXXB
  105. LOCKXB
  106. UNLOCKXB
  107. LOCKKEYXB
  108. UNLOCKKEYXB
  109. LOCKDATAXB
  110. UNLOCKDATAXB
  111. DRIVEREMOTEXB
  112. FILEREMOTEXB
  113. SETRETRIESXB
  114. DELETEFILEDOS
  115. RENAMEFILEDOS
  116. CREATEFILEDOS
  117. ACCESSFILEDOS
  118. OPENFILEDOS
  119. SEEKFILEDOS
  120. READFILEDOS
  121. EXPANDFILEDOS
  122. WRITEFILEDOS
  123. CLOSEFILEDOS
  124. MAKEDIRDOS
  125. ACCESSPACK
  126. BREAKPACK
  127. COPYPACK
  128. CREATEDATAPACK
  129. CREATEKEYPACK
  130. DESCRIPTORPACK
  131. DOSFILEPACK
  132. DVMONPACK
  133. EXITPACK
  134. FIELDDESCTYPE
  135. HANDLEPACK
  136. INITPACK
  137. MEMORYPACK
  138. OPENPACK
  139. REMOTEPACK
  140. SETRETRIESPACK
  141. STATDATAPACK
  142. STATKEYPACK
  143. STATHANDLEPACK
  144. XERRORPACK
  145. ERRORS_BULLET
  146. ERRORS_BULLET_B
  147. ERRORS_BULLET_C
  148. ERRORS_BULLET_D
  149. ERRORS_BASIC
  150. ERRORS_BASIC_B
  151. ERRORS_DOS
  152. ERRORS_DOS_B
  153. ERRORS_DOS_C
  154. INITXBSRC
  155. EXITXBSRC
  156. ATEXITXBSRC
  157. MEMORYXBSRC
  158. BREAKXBSRC
  159. BACKUPFILEXBSRC
  160. STATHANDLEXBSRC
  161. GETEXTERRORXBSRC
  162. DVMONCXBSRC
  163. CREATEDXBSRC
  164. CREATEDXBSRC_A
  165. OPENDXBSRC
  166. CLOSEDXBSRC
  167. STATDXBSRC
  168. READDHXBSRC
  169. FLUSHDHXBSRC
  170. COPYDHXBSRC
  171. ZAPDHXBSRC
  172. CREATEKXBSRC
  173. CREATEKXBSRC_A
  174. OPENKXBSRC
  175. CLOSEKXBSRC
  176. STATKXBSRC
  177. READKHXBSRC
  178. FLUSHKHXBSRC
  179. COPYKHXBSRC
  180. ZAPKHXBSRC
  181. GETDESCRIPTORXBSt
  182. GETRECORDXBSRC
  183. ADDRECORDXBSRC
  184. UPDATERECORDXBSR
  185. DELETERECORDXBSR
  186. UNDELETERECORDSRT
  187. PACKRECORDSXBSRC%
  188. FIRSTKEYXBSRC
  189. EQUALKEYXBSRC
  190. NEXTKEYXBSRC
  191. PREVKEYXBSRC
  192. LASTKEYXBSRC
  193. STOREKEYXBSRC
  194. DELETEKEYXBSRC
  195. BUILDKEYXBSRC
  196. CURRENTKEYXBSRC
  197. GETFIRSTXBSRC
  198. GETEQUALXBSRC
  199. GETNEXTXBSRC
  200. GETPREVXBSRC
  201. GETLASTXBSRC
  202. INSERTXBSRC
  203. UPDATEXBSRC
  204. REINDEXXBSRC
  205. LOCKXBSRC
  206. UNLOCKXBSRC
  207. LOCKKEYXBSRC
  208. UNLOCKKEYXBSRC
  209. LOCKDATAXBSRC
  210. UNLOCKDATAXBSRC
  211. DRIVEREMOTEXBSRC
  212. FILEREMOTEXBSRC
  213. SETRETRIESXBSRC
  214. DELETEFILEDOSSRC
  215. RENAMEFILEDOSSRC~.
  216. CREATEFILEDOSSRC
  217. ACCESSFILEDOSSRCV2
  218. OPENFILEDOSSRC
  219. SEEKFILEDOSSRC
  220. READFILEDOSSRC
  221. EXPANDFILEDOSSRC.;
  222. WRITEFILEDOSSRC
  223. CLOSEFILEDOSSRC
  224. MAKEDIRDOSSRC
  225. ~INDEX            CZ.HLP-BULLET for QB/BASIC PDS
  226.  System 
  227.  Mid-level Record/Key Access 
  228. InitXB        
  229. CreateDXB    CreateKXB    GetDescriptorXB     FirstKeyXB     
  230. ExitXB        
  231. OpenDXB      OpenKXB      GetRecordXB         EqualKeyXB     
  232. AtExitXB      
  233. CloseDXB     CloseKXB     AddRecordXB         NextKeyXB      
  234. MemoryXB      
  235. StatDXB      StatKXB      UpdateRecordXB      PrevKeyXB      
  236. BreakXB       
  237. ReadDHXB     ReadKHXB     DeleteRecordXB      LastKeyXB      
  238. BackupFileXB  
  239. FlushDHXB    FlushKHXB    UndeleteRecordXB    StoreKeyXB     
  240. StatHandleXB  
  241. CopyDHXB     CopyKHXB     PackRecordsXB       DeleteKeyXB    
  242. GetExtErrorXB 
  243. ZapDHXB      ZapKHXB                          BuildKeyXB     
  244. DVmonCXB      
  245.                                               CurrentKeyXB   
  246.  High-level Access 
  247.  Network 
  248. GetFirstXB    InsertXB     
  249. LockXB           UnlockXB        LockKeyXB      
  250. GetEqualXB    UpdateXB     
  251. UnlockKeyXB      LockDataXB      UnlockDataXB   
  252. GetNextXB     ReindexXB    
  253. DriveRemoteXB    FileRemoteXB    SetRetriesXB   
  254. GetPrevXB                  
  255. GetLastXB                  
  256.  Low-level DOS Access 
  257.                            
  258. DeleteFileDOS    OpenFileDOS     WriteFileDOS   
  259.                            
  260. RenameFileDOS    SeekFileDOS     CloseFileDOS   
  261.  Move cursor to index item 
  262. CreateFileDOS    ReadFileDOS     MakeDirDOS     
  263.  and press <Enter>.        
  264. AccessFileDOS    ExpandFileDOS                  
  265. See: TUTORIAL_INDEX
  266. ~TUTORIAL_INDEX   CZ.HLP-BULLET for QB/BASIC PDS
  267.  CZ.COM 
  268.  Using BULLET 
  269.  1.02 
  270. Starting_CZ   
  271. What:              How to:                                   
  272. Using_CZ      
  273.  is_BULLET          design_a_DB         BC_compile_with      
  274. About_CZ      
  275.  is_a_database      create_a_DB         LINK_with            
  276.               
  277.  is_DBF             add_to_the_DB       LIB_with             
  278.  is_a_Btree         query_the_DB        make_a_QLB           
  279.  Error Codes
  280.  is_a_network       update_the_DB      
  281.        
  282. Errors_BULLET 
  283.  is_file_locking    delete_a_record    
  284.  call_BULLET 
  285.        
  286. Errors_BASIC  
  287.  is_NLS                                
  288.        
  289. Errors_DOS    
  290.                     LICENSE_AGREEMENT   Product_Support      
  291.  Structure Pack Types 
  292.  Specifications 
  293. AccessPack       DVmonPack        RemotePack     
  294. Specs_Overall            
  295. BreakPack        ExitPack         SetRetriesPack 
  296. Specs_DBF                
  297. CopyPack         FieldDescTYPE    StatDataPack   
  298. Specs_Index              
  299. CreateDataPack   HandlePack       StatKeyPack    
  300. Specs_Memory             
  301. CreateKeyPack    InitPack         StatHandlePack 
  302. Specs_OS_Calls           
  303. DescriptorPack   MemoryPack       XErrorPack     
  304. Specs_Languages          
  305. DOSFilePack      OpenPack                        
  306. Specs_OSes               
  307.                                                  
  308. Specs_Networks           
  309.                                                  
  310. Specs_Performance        
  311. See: License_Agreement
  312. ~License_Agreement
  313. Before using this software you must agree to the following:
  314.  1. You are not allowed to operate more than one (1) copy of this software
  315.     package at one time per license. This means that if you have 10 programmers
  316.     that COULD possibly use the BULLET library at the same time, you must also
  317.     have ten (10) BULLET licenses.
  318.  2. You are not allowed to distribute non-executable code containing BULLET
  319.     code. This means that you are not allowed to redistribute BULLET code as
  320.     another .LIB, for example. Also, if BULLET code is to be contained in a
  321.     Dynamic Link Library (DLL) then it must be part of a stand-alone product.
  322.     This means that you cannot provide a .DLL containing BULLET code if that
  323.     .DLL is to be used as a programming library for other programmers. If you
  324.     wish to distribute non-executable code containing BULLET code you must
  325.     obtain written permission from the author.
  326.  3. This license grants you the right to use the BULLET library code on a
  327.     royalty-free basis.
  328. See: License_a                                                          -MORE-
  329. ~License_a
  330.  4. BULLET is owned by the author, Cornel Huth, and is protected by United
  331.     States copyright laws and international treaty provisions. You are not
  332.     allowed to make copies of this software except for archival purposes.
  333.  5. You may not rent or lease BULLET. You may not transfer this license without
  334.     the written permission of the author. If this software is an update or
  335.     upgrade, you may not sell or give away previous versions.
  336.  6. You may not reverse engineer, decompile, or disassemble this software.
  337.  7. There are no expressed or implied warranties with this software.
  338.  8. All liabilities in the use of this software rest with the user.
  339.  9. U.S. Government Restricted Rights. This software is provided with
  340.     restricted rights. Use, duplication, or disclosure by the Government is
  341.     subject to restrictions as set forth in subparagraph (c)(1)(ii) of the
  342.     Rights in Technical Data and Computer Software clause at 52.227-7013.
  343.     Manufacturer is Cornel Huth/6402 Ingram Rd/San Antonio, TX 78238.
  344.     This agreement is governed by the laws of the state of Texas.
  345. See: Product_Support
  346. ~Product_Support
  347. Phone support is available 7 days a week, 9AM-9PM Central Time (USA) for
  348. registered users. Phone support for non-registered users is not available.
  349. If you are a registered BULLET user you may call 1-512-684-8065 during the
  350. hours listed above. If I'm not available to handle your call leave a message
  351. on the machine briefly explaining the basis for your call. You MUST leave a
  352. message stating that you want the return call to be COLLECT. Calls cannot be
  353. returned unless you state this in your message (no exceptions).
  354. If you have a problem that you believe to be due to a bug in BULLET, mail a
  355. diskette with the program and data to recreate the problem. Include all source
  356. code, data files, libraries, etc. on the disk that is needed to recreate the
  357. problem. Do not send your entire application. Do not send only a listing. Send
  358. only the code that is sufficient for another person to recreate the problem.
  359. (No exceptions.)
  360. A support BBS is not currently available but is expected to be operational in
  361. the near future. If you would like to use a BBS to communicate you may reach me
  362. at NUL BBS, 1-512-615-6852 (2400-), 615-6851 and 6853 (9600+, HST, V.32bis) or
  363. you may contact me on FidoNet at Cornel Huth @ 1:387/800 or through Internet at
  364. Cornel.Huth@p8.f800.n387.z1.fidonet.org.
  365. See: Starting_CZ
  366. ~Starting_CZ
  367. At CZ's initial load it looks into the current directory for CZ.HLP, then in 
  368. the directory of CZ.COM, and last it looks for the pathname specified by the 
  369. DOS variable CZH (SET CZH=C:\DOC\CZ.HLP). Use /f: for alternate locations.   
  370. Load CZ.COM from the DOS command line. Options are:
  371.         /f:helpfile.ext       Use other than default CZ.HLP help file
  372.         /h# where n=1 to 4    Use alternate hot-key from default Alt-F1
  373.             #=1  Ctrl-h
  374.             #=2  F12
  375.             #=3  left+right Shift
  376.             #=4  Alt-left Shift
  377.         /u  uninstall CZ from memory (after initial load)
  378.         /s  temporarily put CZ to sleep by restoring all hooked vectors
  379.         /r  restore CZ from its sleep by rehooking vectors
  380.         /?  quick help
  381.  E.g., C>cz /f:D:\PRG_C\CBULLET.HLP   supply entire pathname when using /f:
  382.        C>cz /h1                       change hot key from Alt-F1 to Ctrl-H
  383. You can use the /f: at any time, even after the initial install, as all but /u.
  384. See: Using_CZ
  385. ~Using_CZ
  386. To activate CZ press the hot-key while the cursor is on the word you want to
  387. look up. Information on that word, if any, is displayed. If none is available,
  388. an index of help items in the dictionary is shown. Along the top-right of the
  389. index screens is the control bar. You can quickly move to the control bar by
  390. pressing <Home> or the See: line with <End>. Move the cursor to TUTORIAL_INDEX
  391. to select the second index screen or QUIT to return to whatever you were doing
  392. or over any index item. Then press <Enter> to move to that item's help entry.
  393. <F1> can be used as <Enter>. A mouse can also be used and is recommended.
  394. For example, to find out about CreateDXB, type it in your application and move
  395. the cursor on it. Press the hot-key. The CreateDXB screen is displayed. To see
  396. what pack type it uses, move to CreateDataPack (at Pack:) and press <Enter>.
  397. For a source example, move the cursor to Src: CreateDXBsrc. To go straight to
  398. the index from your application, press the hot-key with the cursor on a blank
  399. space. The <Esc> key returns you to your application.
  400. If there are more screens for the current topic the See: line has the same   
  401. topic name plus a letter, and -MORE- at the end. Move the cursor (or mouse)  
  402. to the topicname text (by using the <End> key) and press <Enter> (or click). 
  403. See: Using_CZ_a                                                         -MORE-
  404. ~Using_CZ_a
  405. CZ.COM can be loaded high but it is ESSENTIAL that you have at least 15K of  
  406. free UMB RAM available. It will load in as little as 4.5K but it will not    
  407. operate correctly. Use MEM/c to see how much Upper Memory RAM is available.  
  408. CZ opens the help file at installation. The help file is opened for Read-Only
  409. access with a Deny None sharing attribute. The file is closed when CZ is
  410. uninstalled (C>cz /u). CZ makes use of its own 256-byte stack.
  411. If you have several CZ help files, rename them to their particular application.
  412. For example:
  413. Rename the QuickBASIC BULLET CZ.HLP to QBULLET.HLP. Put QBULLET.HLP into your
  414. help files directory. Put SET CZH=C:\HELPFILES\QBULLET.HLP in your AUTOEXEC.BAT
  415. file. The next time CZ is installed it uses QBULLET.HLP from C:\HELPFILES.
  416. At anytime you can specify CZ.COM to use another help file. For example, if the
  417. current CZ help file is QBULLET.HLP but you want to use the CBULLET.HLP file,
  418. use C>cz /f:\helpfiles\cbullet.hlp. CBULLET.HLP then becomes the active file
  419. the next time you popup CZ.
  420. See: Using_CZ_b                                                         -MORE-
  421. ~Using_CZ_b
  422. Limitations:
  423. 1) The QB environment may interpret the Alt-F1 keypress after CZ has popped
  424. down. If this is a problem then change the hotkey, e.g., C>cz /h2 to use F12.
  425. 2) In the QB (and QBX) environment the keypad <Enter> key is not recognized by
  426. CZ. Use the main <Enter>. This occurs only in then QB 4.5 and QBX editors.
  427. 3) If, after returning from CZ, the QB environment's menu bar does not respond
  428. to Alt-keys (like an Alt-F), click the left mouse button a few times, or press
  429. F6 to go to the immediate window and execute a SHELL. It's unlikely that you'll
  430. encounter this.
  431. 4) CZ is a stable TSR but like all TSRs in a DOS system, unforseen events can
  432. take place that could conceivably cause the computer to crash. Therefore, it's
  433. recommended that you save your work often (you should do so whether a TSR is
  434. installed or not).
  435. 5) CZ currently doesn't reset the mouse. If you're having mouse trouble, you'll
  436. need to reset your mouse driver (type MOUSE at the C>). Many problems come from
  437. other programs not restoring the mouse cursor to its original state.
  438. See: About_CZ
  439. ~About_CZ
  440.               
  441.               
  442.                      CZ HELP                     
  443.               
  444.                                                  
  445.               
  446.       Context-sensitive Online Help Manager      
  447.               
  448.                                                  
  449.               
  450.                      for the                     
  451.               
  452.                                                  
  453.               
  454.                
  455.               
  456.               
  457.                
  458.                
  459.               
  460.                
  461.                
  462.               
  463.                
  464.                
  465.               
  466.                                                  
  467.               
  468.                 compiler libraries               
  469.               
  470.                                                  
  471.               
  472.        MS-DOS QuickBASIC/BASIC PDS version       
  473.               
  474.         (available for most DOS compilers)       
  475.               
  476.                                                  
  477.               
  478.            Copyright 1992  Cornel Huth           
  479.               
  480.                                                  
  481.               
  482. Ver 1.02         INT2F MuxID=C2         15-Aug-92
  483.               
  484. See: Specs_Overall
  485. ~is_BULLET - What?
  486. BULLET is a program module that handles the details of putting information to
  487. and getting information from your hard disk using a standard data file format
  488. called the Xbase DBF format with very fast and efficient index file routines.
  489. It can be used as-is by most DOS compilers.
  490. BULLET is written in 100% assembly language. Why? Two reasons. First, control.
  491. There's no compiler code or run-time library code in between BULLET and your
  492. data. Second, efficiency. BULLET knows exactly what it requires from the
  493. operating system and when. Result: fast, small, and robust applications.
  494. See: is_a_database
  495. ~is_a_database - What?
  496. A database is a collection of data arranged so that the it can be accessed as
  497. useful information. For example, let's say we have two files. Each consists of
  498. two fields. The first file has codenumber and score. The second file has a
  499. codenumber and name. Separately, the files are merely a collection of data.
  500. Together, however, they tie the name to the score:
  501.         score codenumber   codenumber name
  502.          99     100           100     John
  503.          87     155           105     Paul
  504.          66     125           110     George
  505.           :      :             :       :
  506. Codenumber 100 is John, who scored 99. The other members scores are not in the
  507. abbreviated data file listing.
  508. A database can be a single data file but more often it is a group of related
  509. data files and usually these data files are indexed by keys (in the index file,
  510. also called key file) so that very fast, direct access is possible.
  511. See: is_DBF
  512. ~is_DBF - What?
  513. DBF is the file extension of dBASE III-compatible data files (filename.DBF).
  514. The file format is used by dBASE IV, FoxPro and many other database programs.
  515. Many programs can also use the file format to import/export data using it.
  516. The DBF format is the most common data file format used on PCs.
  517. A DBF-compatible data file consists 3 distinct areas. First is the data header.
  518. This contains information such as the number of records in the file. Second is
  519. the field descriptors. These descriptors define the makeup of each field in the
  520. record. The third is the record area. Each record is a logical unit of data.
  521. For example, a record, all of which are made up of the same fields but with
  522. different data, could (conceptually) look like this:
  523.                field 1         field 2         field 3       field n
  524.            
  525.   record 1 
  526. Johnson         
  527. Larry          
  528. 465310555     ...
  529.            
  530.   record 2 
  531. Aberdeen        
  532. Zara           
  533. 465230555     ...
  534.            
  535.   record n
  536. See: is_a_Btree  Specs_DBF
  537. ~is_a_Btree - What?
  538. A b-tree is a sorting method ideally suited to data structures maintained on a
  539. hard disk. It is very fast on retrieval and is inherently self-balancing during
  540. inserts and deletes. Self-balancing ensures performance remains consistent.
  541. The reason the b-tree is ideally suited to hard disks is that, when looking for
  542. a particular key, most of the time involved in accessing the key is spent by
  543. the hard drive moving to various locations on the disk. The task of a good
  544. access method is to reduce the number of seeks that the disk must perform. The
  545. b-tree accomplishes this by maintaining several keys (perhaps 50) on each node,
  546. with the necessary pointers to previous and following nodes. A b-tree of order
  547. 20 (19 keys per node) can find a key in a file of 1,000,000 keys in a MAXIMUM
  548. of 5 disk accesses, where each disk access visits a node.
  549. 'BASIC program to find *max* seeks needed/avg time
  550. Keys& = 1000000: KeysPerNode = 19: AvgSR = 25
  551. Order = KeysPerNode + 1
  552. max = (LOG((Keys& + 1) / 2) / LOG(Order / 2))
  553. PRINT "Max nodes accessed for"; Keys; "keys & b-tree of order"; Order;
  554. PRINT "is"; max; "nodes"
  555. PRINT "Max disk time based on avg seek+read of"; AvgSR;
  556. PRINT "ms is"; AvgSR / 1000 * max; "seconds"
  557. See: is_a_network  Specs_Index
  558. ~is_a_network - What?
  559. A network is a group of computers able to communicate with one another. Often
  560. called a LAN (local area network), a network allows resources to be shared.
  561. Sharing resources can lead to problems if steps are not taken to ensure that
  562. two computers don't try to share the same resource at the same time. For
  563. example, say two computers try to change the same record in a file on a network
  564. drive. Let's say both users are accessing the number of widgets in inventory.
  565. The first user gets there a micro-second before the second and allocates the
  566. last widget in stock. The second user comes in right after and, since the first
  567. user has not yet updated the inventory, allocates the very same widget. One
  568. widget, two users. When the first user updates the inventory, widgets in
  569. inventory is changed to 0 (previous - 1). The second updates the inventory in
  570. the same manner and sets widgets to 1 less what it was when it started, or 0
  571. also. You see the problem.
  572. In order to successfully share a file on a network, the file must first be
  573. locked to a single user. Once that user has locked the file, he has sole access
  574. to the data within it and he will not experience the scenario above. When the
  575. user has completed the changes, he unlocks the file so that others may use it.
  576. See: is_file_locking
  577. ~is_file_locking - What?
  578. File locking is a means to obtain exclusive access to a file. This is needed in
  579. cases of multiple programs or users accessing a shared file at the same time.
  580. There are several methods to ensure only one process or user has access to a
  581. file. The first method is to open the file so that while the file is open only
  582. your program can access any part of it. This is simple to implement and the
  583. operating system handles the details of this. However, it requires your program
  584. to open/close files all the time since no other process may access the file
  585. while it is open.
  586. Another method is to use byte-level locks. Also managed by the OS, this method
  587. allows for restricting access to any particular region within the file. Which
  588. regions are to be locked is to be determined by your program, however, and it
  589. can be complex to perform multiple locks at the byte, field, or record level.
  590. Another use of the byte-level lock is to specify that all bytes within the file
  591. are to be locked. This greatly simplifies the process of obtaining a lock and
  592. has the advantage over a file access lock of not needing to open/close the file
  593. for each lock. It is very fast and easy to implement. BULLET offers all three
  594. lock types.
  595. See: is_NLS
  596. ~is_NLS - What?
  597. NLS stands for National Language Support. This feature is available in DOS 3.3
  598. and later. BULLET makes use of NLS by getting from DOS the current DOS country
  599. collate-sequence table. The collate table is used to properly sort mixed-case
  600. character strings and also foreign (or non-USA) language character strings
  601. according to that country's alphabet. This is an option but is recommended.
  602. In addition, BULLET provides for a programmer-supplied collate-sequence table.
  603. See: design_a_DB
  604. ~design_a_DB - How to
  605. To design a database, above all else, know what information you require from
  606. it. Having established what you need to know, collect the data that lets you
  607. formulate this into useful information.
  608. For example, you want to track a class of students and determine how well they
  609. achieve on tests. The criterion you use is the test score. You determine that
  610. your data is 1) students, 2) tests, and 3) test scores. Too simplify, you use
  611. a single 20-character field for student, a 1-character field for test number
  612. ("1" to the "n" tests), and a numeric field for test scores (0 to 100).
  613. Since the objective is to track students' scores, arrange the data so that
  614. output consists of each student's score in test order. Do this by specifying an
  615. index file containing an index based on the student's name and test number:
  616.   KeyExpression$ = "STUDENT + TEST"       'combine two character fields
  617. This is the reason that field 2, test number, is a character field. It can more
  618. easily be combined with other character fields than a numeric field. By using
  619. the routines of the database langauge, you can easily create the data and index
  620. files, add data, list student's scores, or make changes to the database. Note:
  621. these How_to examples are meant only to show the basis behind an operation.
  622. See: create_a_DB  CreateKXB
  623. ~create_a_DB - How to
  624. Having defined the database, create it. First, create the datafile based on the
  625. 3 fields you defined in your design. To do this, DIM an array for the field
  626. descriptors for the number of fields (see also CreateDataPack):
  627. DIM FD(1 TO 3) AS FieldDescTYPE
  628. FD(1).FieldName = "STUDENT" + STRING$(10,0)   'must be zero-filled
  629. FD(1).FieldType = "C"
  630. FD(1).FieldLength = CHR$(20)               
  631. FD(1).FieldDC = CHR$(0)                    
  632. The FD() is a structure element  
  633. FD(2).FieldName = "TEST" + STRING$(10,0)   
  634. in CDP (CreateDataPack) as in:   
  635. FD(2).FieldType = "C"                      
  636. CDP.Func=CREATEDXB               
  637. FD(2).FieldLength = CHR$(1)                
  638.   :        :                     
  639. FD(2).FieldDC = CHR$(0)                    
  640. CDP.FieldListPtrOff=VARPTR(FD(1))
  641. FD(3).FieldName = "SCORE" + STRING$(10,0)  
  642. CDP.FieldListPtrSeg=VARSEG(FD(1))
  643. FD(3).FieldType = "N"                      
  644.   :        :                     
  645. FD(3).FieldLength = CHR$(3)                
  646. FD(3).FieldDC = CHR$(0)
  647. Call CreateDXB to create the data file. To create the index file, first open
  648. the data file just created, then call CreateKXB to create the index file. Open
  649. the index file so we can use it (data file is already open).
  650. See: add_to_the_DB  CreateDXB
  651. ~add_to_the_DB - How to
  652. Once you have the database designed and the data and key files created and open
  653. you can start putting the student's test data into it. Note that the DBF-format
  654. requires that all data in a data file be in ASCII format. This means that we
  655. must convert the numeric test score into its ASCII form. BASIC has the STR$()
  656. function to do this. In addition, numbers generally should be right-justified
  657. in their field. BASIC has the RSET statement to do this:
  658. TYPE StudentRecordTYPE 'this structure is exactly how the record is on disk
  659. tag AS STRING * 1      'DBF delete tag used to identify deleted records
  660. sname AS STRING * 20   '--the tag is always present in any DBF record
  661. testn AS STRING * 1    '  don't forget to include it in all your TYPEs
  662. score AS STRING * 3
  663. END TYPE '25
  664. DIM SR AS StudentRecordTYPE
  665.      :
  666.    INPUT "Student name, test number, score:",n$,t$,s%
  667.    SR.sname = n$ : SR.testn = t$ : RSET SR.score = STR$(s%)
  668.    status = DoInsert(SR, keyhandle)
  669. LOOP UNTIL LEN(n$) = 0 OR (status <> 0)
  670. See: query_the_DB  InsertXB
  671. ~query_the_DB - How to
  672. Now that you have data in the database you want to see what's in there. Since
  673. the index file is in "STUDENT + TEST" order, the information we'll be getting
  674. out of the database is in Student name order, with each student's scores in
  675. test number order.
  676. If we want to look at all the students, we can use GetFirstXB to retrieve the
  677. first student's score for the first test. GetNextXB retrieves the next record
  678. (the first student's score for the second test), and so on. When all records
  679. have been retrieve GetNextXB returns an End Of File error code.
  680. If we want to look at a particular student's score only, we can use GetEqualXB
  681. to go directly to a student's first test score. GetNextXB get his next and so
  682. on until GetNextXB retrieves the next student's first test score. You can stop
  683. at this point (student names no longer match).
  684. We might also want to find all students who scored less than 65 on any test. To
  685. do this we can GetFirstXB, check SR.score for < 65 and if so print that record.
  686. Continue by using GetNextXB, printing each record that has a score < 65.
  687. See: update_the_DB  GetFirstXB
  688. ~update_the_DB - How to
  689. To update a particular record in the database we must first locate and identify
  690. it using one of the get routines such as GetEqualXB. The Get() routine return
  691. the record data, and also the physical record number of the record accessed,
  692. into the AccessPack RecNo. Having used one of the Get() routines to read the
  693. data record from disk to memory, you can make any changes to the data record in
  694. memory. E.g., if a student's score needs to be changed from a 69 to a 96, first
  695. find the record (and its RecNo), then update the score field:
  696.    INPUT "Student name, test number",n$,t$
  697.    SR.sname = n$ : SR.testn = t$
  698.    status = DoGetStudentTestScore(SR, keyhandle, Recno&)
  699.    DO UNTIL status <> 200   'student as entered not found, call search routine
  700.       status = DoFindStudentTestScore(SR, keyhandle, RecNo&)
  701.    LOOP
  702.    IF status = 0 THEN
  703.       PRINT "Student:" ; SR.sname ; " old score:" ; SR.score
  704.       INPUT "Enter new score:"; s% : RSET SR.score = STR$(val(s%))
  705.       status = DoUpdateTestScore(SR, keyhandle, Recno&)
  706.    ENDIF
  707. Any change to a key field will initiate a key file update automatically.
  708. See: delete_a_record  UpdateXB
  709. ~delete_a_record - How to
  710. To delete a particular record in the database we must first locate it using
  711. one of the get routines such as GetEqualXB. These Get() routines return the
  712. actual record number of the data record accessed by Get() into the AccessPack
  713. RecNo. Having used one of the Get() routines to find the data record, make a
  714. call to the delete function:
  715.    'delete all of Student's records, 1 record for each test he's taken
  716.    INPUT "Student name to delete",n$
  717.    SR.sname = n$
  718.    status = DoGetStudent(SR, keyhandle, RecNo&)
  719.    DO UNTIL status <> 200   'student as entered not found, call search routine
  720.       status = DoFindStudent(SR, keyhandle,RecNo&)
  721.    LOOP
  722.    DO
  723.       status = DoDeleteRecord(SR, RecNo&)  'does not affect key files
  724.       IF status = 0 THEN status = GetNextChkIfSameStudent(SR,keyhandle,RecNo&)
  725.    LOOP UNTIL status <> 0
  726. The DeleteRecordXB routine does not physically remove the record from the data
  727. file but instead tags it as being "deleted".
  728. See: BC_compile_with  DeleteRecordXB
  729. ~BC_compile_with - How to
  730. To create a stand-alone EXE file, compile your BASIC source as required. No
  731. special compiler switches are required. When your compiler is finished and has
  732. reported no errors during the compile, use the LINK program supplied with your
  733. compiler to resolve any external references in your BASIC program code that are
  734. dependant on the BULLET library code.
  735. For example, if you have a single-module BASIC source file called STUGRADE.BAS,
  736. compile it:
  737.  C>bc STUGRADE /o;
  738. If successful, use the LINK program to build the final EXE:
  739.  C>link STUGRADE,STUGRADE.EXE,nul,BULLET.LIB;
  740. If successful, link creates STUGRADE.EXE ready to be run at the DOS prompt.
  741. The BASIC runtime is also supported by BULLET. Just compile as you normally
  742. would (without the /o, of course).
  743. See: LIB_with
  744. ~LIB_with - How to
  745. BULLET.LIB is composed of many separate assembly language modules. All these
  746. modules have been combined into a single, easy-to-use .LIB library. While it
  747. is possible to combine, or add, other .OBJ files or even other .LIB files to
  748. BULLET.LIB, I do NOT, -NOT-, recommend that you do so.
  749. If you need to use two or more libraries with your programs, no problem, LINK
  750. can handle as many as you have. When LINK prompts you for a library file, just
  751. enter BULLET.LIB followed by any other library you need. For example:
  752.  C>LINK
  753.  Microsoft (R) Segmented-Executable Linker  Version 5.10
  754.  Copyright (C) Microsoft Corp 1984-1990.  All rights reserved.
  755.  Object Modules [.OBJ]: STUGRAD1+STUGRAD2+STUB
  756.  Run File [STUGRAD1.EXE]: STUGRADE.EXE
  757.  List File [NUL.MAP]: nul
  758.  Libraries [.LIB]: BULLET MOUSE;
  759. Consult your linker programs documentation for more.
  760. See: make_a_QLB
  761. ~make_a_QLB - How to
  762. If you use the QuickBASIC environment to program in, you need to build a .QLB
  763. so that you can call the BULLET routines. While QuickBASIC can load only a
  764. single QLB ( C>qb /L quicklib.qlb ), you can combine many LIB and OBJ modules
  765. to create the QLB. For example, to make a QLB of the BULLET.LIB, MOUSE.LIB,
  766. and STUB.OBJ modules:
  767.  C>link /QU BULLET.LIB+MOUSE.LIB+STUB, IDE.QLB, nul, BQLB45.LIB;
  768. Note the extension .LIB on the library modules. This is REQUIRED since LINK
  769. assumes .OBJ by default, as in the case of STUB, above. The quick library,
  770. BQLB45.LIB, is required for the Libraries: prompt. The exact name depends on
  771. the compiler version. Consult your compiler documentation for more.
  772. BASIC PDS note: BASIC PDS requires that all BASIC modules included into a QLB
  773. be compiled using the /Fs compiler switch. This instructs the compiler to
  774. generate code compatible with "far strings". Since BULLET is written entirely
  775. in assembly langauge, this is not an issue. However, if you start QBX.EXE with
  776. /L and get an INVALID FORMAT error, one of the modules in the .QLB file most
  777. likely was a BASIC module that was not compiled with the /Fs switch.
  778. See: LINK_with
  779. ~LINK_with - How to
  780. After successfully compiling your BASIC source code module(s), use the LINK
  781. program to build the EXE program file. For this example let's assume that you
  782. have 2 BASIC source code modules just compiled and their .OBJs available, the
  783. BULLET.LIB library, a stub object file called STUB.OBJ, and MOUSE.LIB.
  784. To build the final stand-alone EXE from this group of files, do the following:
  785.  C>link STUGRAD1+STUGRAD2+STUB,STUGRADE.EXE,nul,BULLET+MOUSE;
  786. The 3 object modules, STUGRAD1, STUGRAD2, and STUB, will have their entire code
  787. included in the EXE program, created as STUGRADE.EXE. The 2 library files,
  788. BULLET.LIB and MOUSE.LIB, will have only the code that is actually referenced
  789. by the 3 object modules included into the EXE program.
  790. If successful, link creates STUGRADE.EXE ready to be run at the DOS prompt.
  791. See: call_BULLET  AtExitXB
  792. ~call_BULLET - How to?
  793. BULLET is called through a single entry point. The only argument passed to it
  794. is a segmented far pointer to the control pack. The first two entries in this
  795. pack are the function to be performed and the function return status. BULLET
  796. is a FUNCTION call returning an INTEGER status value.
  797. Each function (or routine) uses a prescribed pack format. For example, some
  798. routines need only know the handle of the file, along with the function number
  799. itself. So, to flush a data file, for example, you would do the following:
  800.  DIM HP AS HandlePack           'could also DIM SHARED
  801.  HP.Func = FLUSHDHXB            'FLUSHDHXB is defined as a CONST in BULLET.BI
  802.  HP.Handle = File2FlushHandle   'the handle as returned from the Open() routine
  803.  stat = BULLET(HP)              'do the actual call to BULLET
  804. The value of stat is set to the completion code as returned by the FlushDHXB 
  805. routine. It is the same as the value returned in HP.Stat *IN ALL BUT A FEW*  
  806. cases: InsertXB, UpdateXB, ReindexXB, and LockXB. These routines return not  
  807. the actual error code, but rather a transaction index number of the access   
  808. that failed. See those routines for more information.                        
  809. See: is_BULLET  FlushDHXB
  810. ~Specs_Overall
  811. BULLET is dBASE III/III+/IV .DBF-compatible. This format is compatible with a
  812. large base of software programs including the latest database packages such as
  813. dBASE IV and FoxPro. Spreadsheet packages such as Excel and 1-2-3 can directly
  814. import BULLET DBF data files, too. And because of BULLET's versatility, it can
  815. also create very non-standard data files. This may be a useful feature if data
  816. secrecy is of concern.
  817. BULLET requires MS-DOS 3.30 or above. It uses 19K of code/static data space and
  818. requires at least 40K of workspace. 140K of workspace is ideal.
  819. Overall Specifications:
  820.               DBF           (per file)          INDEX
  821.       
  822.     Max records: 16,777,215                Max nodes: 65,535
  823.   Record length: 2-4000 (8192)              Max keys: 4,063,170
  824.      Max fields: 128 (255)                Key length: 1-64
  825.    Field length: 1-254 (255)          Max key fields: 16
  826. Total open index plus data files can be up to 255. Numbers in () indicate
  827. extended specifications.
  828. See: Specs_DBF
  829. ~Specs_DBF
  830. To remain compatible with other dBASE III .DBF platforms you should restrict
  831. your data files to the following specifications:
  832.  File ID byte: 3  (83hex if .DBF has memo field, not currently supported)
  833.  Max record size: 4000 bytes  Max fields/rec: 128   Max field size: 254 bytes
  834.  Allowable field name characters: A-Z and the _ (upper-case)
  835.  Allowable field types:
  836.   C-character, 1-254 bytes
  837.   D-date, 8 bytes, in the format YYYYMMDD (19920531)
  838.   L-logical, 1 byte, either space, "T" or "Y", "F" or "N"
  839.   M-memo, 10 bytes, used as pointer into .DBT file (currently not supported)
  840.   N-numeric, 1-19 bytes, ASCII format, uses explicit decimal if needed...
  841.     ...decimal places may be 0, or 2 to (field size - 3) but no more than 15
  842. Restrict all data in .DBF fields to ASCII. This means you should convert binary
  843. data to the equivalent ASCII representation, e.g., if you have the binary value
  844. 22154, it must first be converted to the string "22154" before you can store it
  845. to the .DBF data file. So, while your in-program code deals with binary data,
  846. your I/O code must convert it to/from ASCII. This is a dBASE-compatibility
  847. issue only. If you can forgo these requirements you can use binary fields, any-
  848. character field names, record sizes to 8192 bytes, and up to 255 fields.
  849. See: Specs_DBF_a                                                        -MORE-
  850. ~Specs_DBF_a
  851. A dBASE III .DBF is composed of 3 sections: the header, the field descriptors,
  852. and the data area.
  853. The header structure (first 32 bytes of file):
  854.     Name     Type   Offset  Meaning
  855.  FileID      byte        0  data file type id, 03 standard (43,63,83,88h)
  856.  LastYR      byte        1  last update year, binary
  857.  LastMo      byte        2  last update month, binary
  858.  LastDA      byte        3  last update day, binary
  859.  NoRecs      long        4  number of records in file
  860.  HdrLen      word        8  length of header, including field descriptors, +1
  861.  RecLen      word       10  length of data record including delete tag
  862.  internal    byte    12-31  reserved
  863. The last update values are updated to the current date whenever the .DBF file
  864. is flushed or closed. Likewise, the NoRecs value is updated whenever a record
  865. is added to the .DBF. The FileID is specified when you create the file, HdrLen
  866. and RecLen are computed and stored when the file is created, too.
  867. See: Specs_DBF_b                                                        -MORE-
  868. ~Specs_DBF_b
  869. The field descriptor format (follows header, one per field):
  870.     Name     Type   Offset  Meaning
  871.  FieldName   char        0  field name 10 ASCII characters, A-Z or _ (0-filled)
  872.         0T   byte       10  field name zero-termintor (must be 0)
  873.  FieldType   char       11  field type (C D L M N)
  874.  internal    long       12  reserved
  875.  FieldLen    byte       16  length of this field
  876.  FieldDC     byte       17  decimal count
  877.  internal    byte    18-31  reserved
  878.       
  879. The unused bytes in the FieldName must be set to zeroes (CHR$(0)).
  880. Each field is described by a 32-byte descriptor. The first field's descriptor
  881. starts right after the header proper, at offset +32. After the last field
  882. descriptor is data byte ASCII 13. (Note: the orginal dBASE III has a 0 byte
  883. following this ASCII 13.) Immediately following this is the actual record data.
  884. See: Specs_DBF_c                                                        -MORE-
  885. ~Specs_DBF_c
  886. The data record format:
  887. The first record is located at offset HdrLen (from the header). The first byte
  888. of each record is a delete tag. This tag is maintained by the BULLET routines.
  889. A space, ASCII 32, means the record is not deleted; an asterisk, ASCII 42,
  890. means the record has been deleted (marked as deleted, often this is used as a
  891. method to temporarily tag records, for whatever purpose).
  892. Following the tag is the data for each field, not delimited (i.e., the fields
  893. run together without anything separating them). The second record is at offset
  894. HdrLen+reclen. The start offset of any record in the file can be computed as
  895. (recordnumber - 1) * reclen + HdrLen. All data is in ASCII form.
  896. An EOF marker (ASCII 26) is placed at the end of the last record.
  897. See: Specs_Index
  898. ~Specs_Index
  899. BULLET uses a proprietary, modified b-tree index method to manage the index
  900. files. The supported key types are:
  901.     Type     Length  Meaning
  902.  Character     1-64  ASCII, NLS, or user-supplied sort table
  903.  Integer          2  signed or unsigned 16-bit value
  904.  Long Int         4  signed or unsigned 32-bit value
  905. In addition to the above types, BULLET allows for unique or duplicate keys in
  906. the index file. If duplicates are allowed, BULLET enumerates each key with an
  907. enumerator word (see FirstKeyXB).
  908. The key may be composed of up to 16 character fields or substrings within those
  909. fields. Numeric fields are considered character fields by BULLET unless the key
  910. is set to binary (see KeyFlags). Integer or LongInt binary keys can be composed
  911. of a single field only. The key expression is specified in text (e.g., "LNAME+
  912. SUBSTR(FNAME,1,1)+MI") and is fully evaluated when the index file is created.
  913. A BULLET index file is composed of 3 sections: the header, the collate-sequence
  914. table, and the node/key entry area.
  915. See: Specs_Index_a                                                      -MORE-
  916. ~Specs_Index_a
  917. The header structure:
  918.     Name     Type   Offset  Meaning
  919.  FileID      byte        0  index file type id, 20
  920.  RootNode    word        1  root node number
  921.  Keys        24bit       3  number of keys in index file
  922.  AvalNode    word        6  node number available for reuse
  923.  FreeNode    word        8  next free node number
  924.  KeyLen      byte       10  key length
  925.  NodeKeys    byte       11  number of keys that fit on a node
  926.  CodePage    word       12  code page ID
  927.  CtryCode    word       14  country code
  928.  internal    byte    16-21  reserved
  929.  KeyFlags    word       22  key flags
  930.  KeyExprn    byte   24-159  key expression
  931.  internal    byte      160  reserved
  932.  KeyXFlds    byte      161  number of fields used by key (1-16)
  933.  KeyXlate    byte  162-225  translated key expression
  934.  internal    byte  226-253  reserved
  935.  CTsize      word      254  collate-sequence table size
  936. See: Specs_Index_b                                                      -MORE-
  937. ~Specs_Index_b
  938. The collate-sequence table structure:
  939.  table      byte   256-511  sort weight table of ASCII character 0-255
  940. Node/key entry structure (first entry is in node #1, file offset 512):
  941.   2A  0A 00  KEY123  7B 00 00  12 00  KEY178  B2 00 00  0C 00 ...
  942.    1.   2.     3.       4.       5.     6.       7.       8.   9.
  943.       
  944.  1. Key count for that node (first byte of each node)
  945.  2. 16-bit node back pointer (for non-leaf nodes, 0 if leaf node)
  946.  3. First key value, "KEY123" in this case
  947.  4. 24-bit data record pointer (low word/hi byte) 7Bh = DBF record number 123
  948.  5. 16-bit node forward ptr/back ptr (for non-leaf nodes, 0 if leaf node)
  949.     --in this case, it indicates that the key following KEY123 is in node# 12h
  950.     --and also that the key before KEY178 is in that node as well
  951.  6. Second key (here "KEY178")
  952.  7. 24-bit data pointer (record number in DBF)
  953.  8. 16-bit forward node pointer (for non-leaf nodes, 0 if leaf node)
  954.  9. Repeat 6 to 8 for each key on node. (node size is 512 bytes)
  955. See: Specs_Index_c                                                      -MORE-
  956. ~Specs_Index_c
  957. As in many b-tree implementations, BULLET's index files maintain an average
  958. load percentage of approximately 66%. This means that in any given node, 66% of
  959. the available space is in use. The free space in the node is attributable to
  960. the constant reshaping of the file as keys are inserted or deleted, causing the
  961. nodes to be split and merged. A split will occur when an insert needs to add a
  962. key to an already full node; a merge will occur when a neighboring node is
  963. small enough to be merged into a just split node. This constant prune-and-graft
  964. of the b-tree results in a node load of about 66% (50% in degenerate cases such
  965. as with already sorted data). It's this aspect of the b-tree that makes it a
  966. consistent performer and a widely-used method of managing index files.
  967. The following formula can be used to determine the number of keys that an index
  968. file can hold:
  969.   MaxKeys = MaxNodes * MaxKeysPerNode * LoadFactor
  970.   MaxKeys = 65535 * 509/(keylen+5) * .66
  971. The load factor can be increased to ~95% by using the ReindexXB routine. This
  972. load factor results in superior retrieval speeds since there are more keys on
  973. each node. Insertion speed will be decreased, however, since splitting will
  974. occur more frequently, though perhaps not noticeably.
  975. See: Specs_Memory
  976. ~Specs_Memory
  977. BULLET allocates memory on an as-needed basis. When linked to an executable
  978. program, BULLET makes use of 17.5K of code space and about 1.5K of static
  979. DGROUP data space. To accomodate the wide variety of compilers, BULLET's API
  980. structure will have the linker included all of the library into your final EXE
  981. program.
  982. All runtime memory allocations are obtained from the operating system. This
  983. means that if your compiler generates code to allocate all the free memory at
  984. startup for its far heap, you need to instruct it to free up some memory for
  985. BULLET's use. In QuickBASIC you can use SETMEM(). You can also use the linker
  986. /CP:n option to limit the amount that the compiler-generated startup code
  987. allocates. The EXEHDR.EXE program can also be used to modify this amount. The
  988. linker /CP: option and the EXEHDR program both modify the EXE header. To
  989. determine if you need to release memory use the MemoryXB routine. It reports
  990. the operating system memory available for use by BULLET.
  991. The amount of memory that BULLET requires is based on which routines are used.
  992. See the next screen for a list of the routines that make malloc calls to the
  993. operating system and how much memory they require.
  994. (Most compilers don't grab all memory as QuickBASIC when it's using $DYNAMIC).
  995. See: Specs_Memory_a  MemoryXB                                           -MORE-
  996. ~Specs_Memory_a
  997. Routines making dynamic memory allocations and amount (within 
  998.  16 bytes):
  999.   Routine           Bytes        Basis
  1000. InitXB                  272   permanent, released when program ends (JFTmode=1)
  1001. BackupFileXB             32K  temp, released when routine exits
  1002. CreateDXB        48+(NF*32)   temp, released when routine exits (NF=NoFields)
  1003. CreateKXB               544   temp, released when routine exits
  1004. OpenDXB     144+((1+NF)*32)   semi-permanent, released when file closed
  1005. OpenKXB                1264   semi-permanent, released when file closed
  1006. PackRecordsXB      RL to 64K  temp, released when routine exits (RL=RecLength)
  1007. ReindexXB        32K to 128K  temp, released when routine exits
  1008. UpdateXB              2K+RL   temp, released when routine exits (RL=RecLength)
  1009. For example, when BackupFileXB is called it attempts to allocate 32K from the
  1010. OS. If 32K is not available, BackupFileXB returns with an error code of 8 (DOS
  1011. error #8, not enough memory). And, for example, ReindexXB attempts to allocate
  1012. 128K if available. If not, it continues in decrements of 32K, down to 32K.
  1013. Needed stack space is 4K (max) for ReindexXB. Other routines can operate with
  1014. less than 1K of stack space. In other words, stack use is minimal.
  1015. See: Specs_OS_calls
  1016. ~Specs_OS_calls
  1017. BULLET makes use of the following operating system calls:
  1018. INT21/25 DOS_setvector                  INT21/44/0B DOS_setsharingretrycount
  1019. INT21/2A DOS_getdate                    INT21/48 DOS_malloc
  1020. INT21/30 DOS_version                    INT21/49 DOS_free
  1021. INT21/35 DOS_getvector                  INT21/51 DOS_getpsp
  1022. INT21/39 DOS_makedir                    INT21/56 DOS_renamefile
  1023. INT21/3D DOS_openfile                   INT21/59 DOS_getextendederror
  1024. INT21/3E DOS_closefile                  INT21/5A DOS_createtempfile
  1025. INT21/3F DOS_readfile                   INT21/5B DOS_createnewfile
  1026. INT21/40 DOS_writefile                  INT21/5C DOS_lockunlockfile
  1027. INT21/41 DOS_deletefile                 INT21/65/01 DOS_getextendedcountryinfo
  1028. INT21/42 DOS_movefileptr                INT21/65/06 DOS_getcollatesequencetable
  1029. INT21/44/09 DOS_isdriveremote           INT21/67 DOS_sethandlecount
  1030. INT21/44/0A DOS_isfileremote            INT2F/10/00 DOS_isshareinstalled
  1031. No other operating system calls are made. No BIOS calls are made.
  1032. See: Specs_Languages
  1033. ~Specs_Languages
  1034. BULLET is compatible with most DOS compilers. The only requirements are that
  1035. your compiler allow you to:
  1036.  1. Call a library routine via a FAR call using PASCAL calling convention
  1037.  2. Pass a far pointer (of the parameter pack) on the stack, by value
  1038.  3. Supply far pointers to the various pack parameters
  1039.  4. Be able to return an integer value from the FAR call
  1040.     (this is optional but recommended for the transaction-based routines)
  1041. These requirements can be met with most BASIC, C, and other-language DOS
  1042. compilers.
  1043. CZ online help is currently available in BASIC and C versions. Others are
  1044. pending. You should be able to do well with either of these versions using
  1045. other-language compilers since the only difference is the source code examples.
  1046. See: Specs_OSes
  1047. ~Specs_OSes
  1048. BULLET is currently available only for MS-DOS and compatible operating systems.
  1049. It requires DOS 3.3 or higher.
  1050. To provide efficient memory use, BULLET uses a single-buffer cache per index
  1051. file. The single-buffer cache also provides for very quick network access since
  1052. a minimum amount of memory needs to be flushed when releasing control of BULLET
  1053. files. For maximum speed, however, an external high-performance disk cache can
  1054. be used. Hyperdisk is a good choice (shareware, $50+). A properly configured
  1055. cache can increase BULLET's performance from 10 to 300%. The most improvement
  1056. is with the InsertXB routine. The least is with ReindexXB and PackRecordsXB,
  1057. which do most of their work in temporarily allocated memory. Hyperdisk is about
  1058. the best designed disk cache available for PCs.
  1059. If you do not use a disk cache then it's recommended that you set your BUFFERS=
  1060. statement in CONFIG.SYS to at least 20 or 30. Even without a disk cache, BULLET
  1061. is still very fast. Also, be sure to set your FILES= to the number of files
  1062. that you'll be opening at any one time. If you set FILES=20 you can have BULLET
  1063. open 14 files (CZ.COM uses 1 and DOS reserves 5 more). You can set FILES=255
  1064. allowing BULLET to open up to 249 files at one time.
  1065.                  DO NOT set FILES= to a value greater than 255.
  1066. See: Specs_Networks
  1067. ~Specs_Networks
  1068. BULLET currently operates on all DOS-compatible network platforms.
  1069. Be sure to install SHARE.EXE on the local machine. If you'll be opening many
  1070. files you should extended the default SHARE file-sharing information space and
  1071. the number of locks that can performed at one time. The DOS 5.0 default is
  1072. /F:2048 and /L:20. This allocates 2K for file-sharing info space and allows 20
  1073. consecutive locks to be active. If the F: value is too low, error 5 (extended
  1074. error 32) is returned on an open attempt. If you extend the JFT in InitXB and
  1075. plan to use many files, say more than 50, be sure to extend /F: by 2K for every
  1076. 50 additional files and set the /L: to the number of files you plan on having
  1077. open. If L: is too low, error 1 (ext err 36) is returned on a lock attempt.
  1078. As an example, if you'll be using 100 files, set FILES=106 in CONFIG.SYS, set
  1079. SHARE /F:4096 /L:106, and IP.JFTmode=1 for InitXB. These values are a minimum.
  1080. If you have more than one process active, you need to account for other
  1081. applications' needs also.
  1082. Note that Windows always returns a "SHARE is installed" using the DOS detection
  1083. routines used by BULLET. To determine if SHARE is actually installed, attempt
  1084. to perform a lock using one of the LockXB routines. An error code indicates
  1085. that SHARE is not installed.
  1086. See: Specs_Performance
  1087. ~Specs_Performance
  1088.  Test: Reindex 1,000 to 1,000,000 records (BB_LAI10.BAS)
  1089.        DBF: extended DBF using binary sort field
  1090.        key: LONG+SIGNED+UNIQUE                        Machine: 486/33 SHO
  1091.  1Meg
  1092.                                                      *
  1093.      
  1094.      
  1095.                                     *
  1096.      
  1097.                    Records  Time  Reindex Rate
  1098.      
  1099.        *           -------  ----  ------------
  1100.  100k
  1101.   *                   1000   < 1  1000+/sec
  1102.      
  1103.                       5000     2    2500
  1104.      
  1105.  *                   10000     4    2500
  1106.      
  1107. *                    25000     7    3571   3500+ records indexed/second!
  1108.      
  1109.                      50000    14    3571   Times in table are in seconds
  1110.   10k
  1111. *                   100000    28    3571
  1112.      
  1113.                     200000    81    2469
  1114.      
  1115. *                   500000   355    1408
  1116.      
  1117.                    1000000  1124     890
  1118.    1k
  1119.      
  1120.  time (secs)  100       200       300       400       18:00     20:00 (min)
  1121. See: Specs_Perf_a                                                       -MORE-
  1122. ~Specs_Perf_a
  1123.  Test: Add 1,000 to 1,000,000 records (BB_LAI10.BAS)
  1124.        DBF: extended DBF using binary sort field
  1125.        key: not indexed                               Machine: 486/33 SHO
  1126.  1Meg
  1127.                                                       *
  1128.      
  1129.      
  1130.                          *
  1131.      
  1132.          *         Records  Time    Add Rate
  1133.      
  1134.                    -------  ----  ------------
  1135.  100k
  1136.     *                 1000   < 1  1000+/sec
  1137.      
  1138.                       5000     2    2500
  1139.      
  1140.   *                  10000     4    2500
  1141.      
  1142. *                    25000    12    2083   2000+ records added/second!
  1143.      
  1144.                      50000    24    2083   Times in table are in seconds
  1145.   10k
  1146. *                   100000    50    2000
  1147.      
  1148.                     200000   103    1942
  1149.      
  1150. *                   500000   262    1908
  1151.      
  1152.                    1000000   529    1890
  1153.    1k
  1154.      
  1155.  time (secs)  100       200       300       400        8:00     10:00 (min)
  1156. See: Specs_Perf_b                                                       -MORE-
  1157. ~Specs_Perf_b
  1158.  Test: Access 1,000 to 1,000,000 keys(*), keys+records(+) (BB_LGK10.BAS)
  1159.        DBF: extended DBF using binary sort field
  1160.        key: LONG+SIGNED+UNIQUE                        Machine: 486/33 SHO
  1161.  1Meg
  1162.                                          *            +
  1163.      
  1164.      
  1165.               *                          +
  1166.      
  1167.     *        +  Keys   Time  Access Rate   Keys+Recs Time  Access Rate
  1168.      
  1169.               -------  ----  -----------   --------- ----  ------------
  1170.  100k
  1171.  *   +           1000   < 1  1000+/sec         1000   < 1  1000+/sec
  1172.      
  1173.                 10000     1    10000          10000     6    1667
  1174.      
  1175.                100000    22     4545         100000    68    1471
  1176.      
  1177.                200000    49     4082         200000   144    1389
  1178.      
  1179.                500000   147     3401         500000   427    1171
  1180.   10k
  1181. *+            1000000   424     2358        1000000   948    1055
  1182.      
  1183.      
  1184.              Times for forward/reverse (Next/Prev) were similar (
  1185.      
  1186. +            Times in table are in seconds
  1187.    1k
  1188.      
  1189.  time (secs)  100       200       300       400       15:00     17:00 (min)
  1190. See: Specs_Perf_c                                                       -MORE-
  1191. ~Specs_Perf_c
  1192.  Test: Insert 1,000 random records to existing data/key files (BB_LAA10.BAS)
  1193.        DBF: extended DBF using binary sort field
  1194.        key: LONG+SIGNED+UNIQUE                        Machine: 486/33 SHO
  1195.  Base records/keys   Inserted   Time / Rate
  1196.  -----------------   --------   ----   ----
  1197.               1000       1000     15     67 records+keys inserted/second
  1198.              10000       1000     18     56 Times in table are in seconds
  1199.             100000       1000     19     53
  1200.             200000       1000     20     50
  1201.  This tests the InsertXB speed. A data file containing the base records and
  1202.  an index file containing the same number of keys has inserted into it 1000
  1203.  random keys and records. The records are added to the end of the data file
  1204.  and the keys are inserted into their appropriate place in the index file.
  1205.  Typically InsertXBs would be done online. The rate of 50 inserts/second at
  1206.  200,000 records would indicate a time of 0.02 seconds per insert on even a
  1207.  very large database (0.015 secs/insert @ 1000 records).
  1208. See: Specs_Perf_d                                                       -MORE-
  1209. ~Specs_Perf_d
  1210.  Test: Update 1,000 records by changing the key field (BB_LAU10.BAS)
  1211.        DBF: extended DBF using binary sort field
  1212.        key: LONG+SIGNED+UNIQUE                        Machine: 486/33 SHO
  1213.  Base records/keys    Updated   Time / Rate
  1214.  -----------------    -------   ----   ----
  1215.               1000       1000     50     20 records+keys updated/second
  1216.              10000       1000     59     17 Times in table are in seconds
  1217.             100000       1000    108      9
  1218.             200000       1000    126      8
  1219.  This tests the UpdateXB speed. A data file containing the base records and
  1220.  an index file containing the same number of keys has the first 1000 keys and
  1221.  records changed. This forces the old data record to be replaced, the old index
  1222.  key to be deleted, and a new key for the record to be inserted in the index
  1223.  file.
  1224.  Typically UpdateXBs would be done online. The rate of 8 updates/second at
  1225.  200,000 records would indicate a time of 0.125 seconds per update on even a
  1226.  very large database (0.05 secs/update @ 1000 records).
  1227. See: Specs_Overall
  1228. ~InitXB
  1229. Pack: InitPack          Src: InitXBsrc          Func:   0/System
  1230. Before using any routine you must initialize the BULLET file system.
  1231. If you want more than the standard number of file handles, set InitPack.JFTmode
  1232. to 1. This expands the current process's Job File Table to allow 255 open files
  1233. maximum.
  1234. On return the DOS version (INT21/30h) is in InitPack.DOSver. Major version in
  1235. the high byte. Minor in the low. The BULLET version (*100) is returned as is
  1236. the address of the ExitXB routine. You can use this address to register ExitXB
  1237. with your own _atexit function if your runtime library does not provide _atexit
  1238. already.
  1239. Note: _atexit is a routine available in most DOS, OS/2, and ANSI runtime
  1240. library code and is called just prior to the program ending. See AtExitXB for
  1241. information on what to do if your library does not have _atexit.
  1242. See: ExitXB
  1243. ~ExitXB
  1244. Pack: ExitPack          Src: ExitXBsrc          Func:   1/System
  1245. Before ending your program you should call ExitXB to close any open BULLET
  1246. files. This also will release any memory still allocated to those files.
  1247. This restores the default keyboard break handlers if they were changed.
  1248. In normal operation you would see to closing all files yourself. However, if
  1249. your program fails to reach the programmed end, it's very possible that files
  1250. may still be left open. It is essential that you properly close all BULLET
  1251. files before ending. There are two methods to achieve this:
  1252. 1. In BASIC use ON ERROR GOTO label, where label is in the main module. The
  1253. code at label would then call ExitXB.
  1254. 2. Use AtExitXB to automatically register ExitXB to be executed in the normal
  1255. shut-down code of the compiler. This method is preferred.
  1256. In the QB environment you can easily stop and restart the executing program
  1257. without having reached the end of the program where you call ExitXB. Previously
  1258. opened BULLET files remain open and memory used remains allocated. Eventually
  1259. you will run out of files or out of memory. Use AtExitXB to prevent this.
  1260. See: AtExitXB
  1261. ~AtExitXB
  1262. Pack: ExitPack          Src: AtExitXBsrc        Func:   2/System
  1263. Used to automatically close all BULLET files, release allocated memory, and
  1264. restore the default Break handlers when your program ends. Your compiler
  1265. generates specific code to be executed in the course of ending your program.
  1266. AtExitXB registers the ExitXB routine to be performed in this compiler-
  1267. generated code.
  1268. This routine is standard in most DOS, OS/2, and ANSI runtime libraries. If   
  1269. yours does not have _atexit, then you must link with the supplied            
  1270. NOATEXIT.OBJ file:                                                           
  1271.                                                                              
  1272. C>link YOURPRG + NOATEXIT, ...                                               
  1273. You can tell if your compiler doesn't supply _atexit at link time. LINK reports
  1274. '_atexit' : unresolved external. Add NOATEXIT.OBJ as described above.
  1275. Be sure that your _atexit routine is for the medium, large, or huge memory
  1276. models since BULLET uses multiple code segments and far calls.
  1277. See: MemoryXB  ExitXB  BreakXB
  1278. ~MemoryXB
  1279. Pack: MemoryPack        Src: MemoryXBsrc        Func:   3/System
  1280. This is the only BULLET routine that can be used before InitXB. It reports the
  1281. largest free block of memory available from the OS. This memory does not
  1282. include fragmented memory or UMB memory that BULLET can and will use.
  1283. Some compilers provide their own memory management and thus will use most or 
  1284. all of the contiguous memory when its program loads. BULLET, however,        
  1285. allocates memory on an as-needed basis, directly from the OS, and releases it
  1286. back to the OS as soon as it is no longer needed. If the memory amount       
  1287. returned by MemoryXB is low, your compiler's startup code has pre-allocated  
  1288. all OS memory. If the memory available from the OS is less than your         
  1289. application needs, you need to instruct your program to release some of the  
  1290. memory back to the OS so BULLET can use it. For QuickBASIC and BASIC PDS, see
  1291. the BASIC function SETMEM().                                                 
  1292. With DOS able to use UMB memory, memory for BULLET requests may be provided
  1293. from this region. You can use StatPack.HereSeg from StatXB to locate from which
  1294. segment address the allocations are being made. Anything above C800h is UMB.
  1295. See: BreakXB  StatXB  OpenDXB  OpenKXB
  1296. ~BreakXB
  1297. Pack: BreakPack         Src: BreakXBsrc         Func:   4/System
  1298. Disables system response to Control-C and Control-Break keys preventing users
  1299. from inadvertently exiting the program without first doing a BULLET shutdown.
  1300. It's REQUIRED that you reinstate the default break handlers with this routine
  1301. before ending your program. ExitXB automatically reinstates the default break
  1302. handlers.                                                                    
  1303. This routine will not disable Control-Alt-Delete (a warm-boot). If the user is
  1304. at this point, he may prefer to exit via a warm-boot rather than reset the
  1305. machine.
  1306. Also, this routine does not prevent QuickBASIC and BASIC PDS from terminating
  1307. a program at an INPUT statement. This is because these versions of BASIC are
  1308. using their own method of INPUT aside from DOS. If AtExitXB has been issued,
  1309. all BULLET files will be properly closed even if *User Break* occurs.
  1310. This routine will not surpress the ^C displayed by DOS. If you don't want the
  1311. ^C to be displayed move the cursor to a location off-screen, say, row 26.
  1312. See: BackupFileXB  ExitXB
  1313. ~BackupFileXB
  1314. Pack: CopyPack          Src: BackupFileXBsrc    Func:   5/System
  1315. Copy an open BULLET key or data file. BULLET repacks and reindexes files in-
  1316. place, requiring less disk space to perform the function. BackupFileXB allows
  1317. you to safely copy a file before doing this.
  1318. This function is recommended prior to packing a data file with PackRecordsXB 
  1319. since the data is very valuable. There is probably little need to do so when 
  1320. reindexing an index file since index files can be constructed very easily    
  1321. from the data file.                                                          
  1322. See: StatHandleXB  PackRecordsXB  ReindexXB
  1323. ~StatHandleXB
  1324. Pack: StatHandlePack    Src: StatHandleXBsrc    Func:   6/System
  1325. Get information on a DOS file handle number to determine if it is a BULLET file
  1326. and if so, if that file is a BULLET key or data file.
  1327. If the returned ID value is 0, the handle is to a BULLET index file. ID=1 then
  1328. the handle is a BULLET .DBF file. ID= -1 then the handle is not a BULLET file.
  1329. See: CreateDXB  StatDXB  StatKXB
  1330. ~GetExtErrorXB
  1331. Pack: XErrorPack        Src: GetExtErrorXBsrc   Func:   7/System
  1332. Get the extended error information for the last operation. This information
  1333. includes the extended error code, the error class, the recommended action, and
  1334. the location of the error. See Errors_DOS for the extended error meaning an
  1335. Errors_DOS_c for the class, action, and locus code meanings.
  1336. Note that on fatal DOS errors, such as an open floppy drive door, the extended
  1337. error code returned is 83 - fail on INT24. This indicates that the INT24
  1338. handler was invoked by DOS and that the INT24 handler told DOS to ignore the
  1339. error. (BULLET invokes its own INT24 handler each time it accesses the DOS file
  1340. system and restores it promptly after the access.) In such cases, this extended
  1341. error code is less informative than the standard return code and, the other
  1342. 'extended' information should be disregarded. (In fatal DOS errors the standard
  1343. return code IS the extended error code.)
  1344. This routine returns the extended error information for the LAST DOS system  
  1345. error. This information remains the same until the next DOS system error.    
  1346. See: CreateDXB  Errors_DOS
  1347. ~DVmonCXB
  1348. Pack: DVmonPack         Src: DVmonCXBsrc        Func:   9/DEBUG
  1349. Control BULLET debug monitor.
  1350. This routine is available only in the debug engine.                          
  1351. The monitor displays in realtime the state of a data file handle, or an index
  1352. and data file handle pair if an index handle is specified. DVmonCXB is best
  1353. used on dual-display systems in which the video output is sent to the secondary
  1354. video monitor. In any case, a 4000-byte screen image is updated in real-time.
  1355. To use the monitor, set mode=1, handle=file to monitor, and VideoSeg=segment
  1356. address of 4000-byte area. The typical VideoSeg would be to video memory. If
  1357. you have a color system as the main monitor and a mono as the secondary, set
  1358. VideoSeg=&HB000. Detail system stats are continually updated to the secondary
  1359. monitor. If you have a single monitor with at least 2 video pages, set VideoSeg
  1360. to your base address plus the page size\16, typically &HB800+(4096\16). If you
  1361. have only a single-page video system, you can allocate a 4000-byte memory area
  1362. and update the video manually by moving it to your video display (80x25).
  1363. See: CreateDXB  StatDXB  StatKXB
  1364. ~CreateDXB
  1365. Pack: CreateDataPack    Src: CreateDXBsrc       Func:  10/Mid-level
  1366. Create a new BULLET .DBF data file. Before using this routine allocate a field
  1367. description array of TYPE FieldDescTYPE for at least as many fields as are in
  1368. the record.
  1369. Conventional dBASE .DBF files have a FileID=3. Other possible FileIDs that you
  1370. may come across are (in hex):
  1371.  43h \__ are special-use Xbase IV DBF files, BULLET can process these file IDs
  1372.  63h /                                    since they are similar to ID type 3
  1373.  83h --- this DBF file has an Xbase III/III+ memo field/file
  1374.  88h --- this DBF file has an Xbase IV memo field/file
  1375. In creating your .DBF files, specify FileID=3 to ensure compatibility across 
  1376. Xbase versions.                                                              
  1377. BULLET makes no special use of the FileID byte.
  1378. See: OpenDXB  FieldDescTYPE  CreateKXB
  1379. ~OpenDXB
  1380. Pack: OpenPack          Src: OpenDXBsrc         Func:  11/Mid-level
  1381. Open an existing .DBF data file for use. You need to specify two things, the
  1382. filename and the DOS file access mode. If the open succeeds, the DOS file
  1383. handle is returned. Use this handle for all further access to this file.
  1384. Each .DBF data file you open allocates 144+((1 + number of fields) * 32) bytes
  1385. for internal use. This memory is not deallocated until you close the file with
  1386. CloseDXB or execute ExitXB.
  1387. You must open the data file before you can open (or create) any of its index
  1388. files.
  1389. See: CloseDXB  OpenKXB
  1390. ~CloseDXB
  1391. Pack: HandlePack        Src: CloseDXBsrc        Func:  12/Mid-level
  1392. Close an existing .DBF data file for use. Closing the file updates the file
  1393. header and deallocates the memory used by this file.
  1394. You MUST close all BULLET files before ending your program or file corruption
  1395. may occur. To ensure that all files are closed in the event of an unscheduled
  1396. program termination, use AtExitXB.                                           
  1397. See: StatDXB  ExitXB  CloseKXB
  1398. ~StatDXB
  1399. Pack: StatDataPack      Src: StatDXBsrc         Func:  13/Mid-level
  1400. Get basic information on the BULLET .DBF data file handle specified.
  1401. Information returned includes the number of records in the file, the record
  1402. length, number of fields per record, and the date the file was last updated.
  1403. Typically, your program will keep track of whether a particular handle belongs
  1404. to a data file or a key file. In cases where this is not possible, call the
  1405. StatHandleXB routine to determine what file type a handle is.
  1406. Note that a just-created data file will have the LastUpdate date set to 0/0/0.
  1407. See: ReadDHXB  StatKXB  StatHandleXB
  1408. ~ReadDHXB
  1409. Pack: HandlePack        Src: ReadDHXBsrc        Func:  14/Mid-level
  1410. Reload the disk copy of the data header for the opened .DBF data file handle
  1411. to the internal copy.
  1412. In single-user, single-tasking systems this routine is not needed. However, in
  1413. a multi-user or multi-tasking system it's possible, and desirable, for two or
  1414. more programs to use the same data file. Consider this scenario: A data file
  1415. has 100 records. Two programs access this data file, both opening it. Program 1
  1416. locks the file, adds a new record, then flushes and unlocks the file. Program 1
  1417. knows that there are now 101 records in the file. However, Program 2 is not
  1418. aware of the changes that Program 1 made--it thinks that there are still 100
  1419. records in the file. This out-of-sync situation is easily remedied by having
  1420. Program 2 reload the data header from the file on disk.
  1421. How does Program 2 know that it needs to reload the header? It doesn't. Instead
  1422. BULLET uses a simple yet effective approach when dealing with such problems.
  1423. Whenever your program locks a file, BULLET automatically reloads the header.
  1424. Whenever you unlock a file, BULLET automatically flushes the header.
  1425. See: FlushDHXB  ReadKHXB  LockXB
  1426. ~FlushDHXB
  1427. Pack: HandlePack        Src: FlushDHXBsrc       Func:  15/Mid-level
  1428. Write the internal copy of the data header for the opened .DBF data file handle
  1429. to disk. The actual write occurs only if the header has been changed.
  1430. This is to ensure that the data header on disk matches exactly the data header
  1431. that is being maintained by BULLET. Also, this routine updates the operating
  1432. system's directory entry for this file.
  1433. Assume the following: A data file with 100 records. Your program opens the data
  1434. file and adds 1 record. Physically, there are 101 records on disk. However, the
  1435. header image of the data file on disk still reads 100 records. This isn't a
  1436. problem, BULLET uses its internal copy of the data header and the internal copy
  1437. does read 101 records. BUT, if there were a system failure now, the disk image
  1438. would not get updated. After the system restart, BULLET opens the file, reads
  1439. the header and thinks that there are 100 records. You lost a record. Now, if
  1440. after that add above, your program issued a FlushDHXB, the header on disk is
  1441. refreshed with the internal copy, keeping the two in-sync. Also, the routine
  1442. updates the DOS directory entry, keeping things neat there as well. Still, it
  1443. doesn't come without cost: flushing will take additional time, therefore, you
  1444. may elect to flush periodically, or whenever the system is idle.
  1445. See: CopyDHXB  ReadDHXB  FlushKHXB  LockXB
  1446. ~CopyDHXB
  1447. Pack: CopyPack          Src: CopyDHXBsrc        Func:  16/Mid-level
  1448. Copy the .DBF file structure of an open data file to another DOS file.
  1449. This routine makes it easy for you to duplicate the structure of an existing
  1450. .DBF file without having to specify all the information needed by CreateDXB.
  1451. The resultant .DBF will be exactly like the source, including number of fields
  1452. and field descriptions. It will contain 0 records.
  1453.      
  1454. See: ZapDHXB  CopyKHXB
  1455. ~ZapDHXB
  1456. Pack: HandlePack        Src: ZapDHXBsrc         Func:  17/Mid-level
  1457. Delete all records for a .DBF data file.
  1458. This routine is similar to CopyDHXB except for one major difference: ALL DATA
  1459. RECORDS IN THE *SOURCE* FILE ARE PHYSICALLY DELETED, so be *careful*.
  1460. If you have a .DBF file with 100 records and use ZapDHXB on it, all 100 records
  1461. will be physically deleted and the file truncated to 0 records. There is no
  1462. return from this routine. All data is gone.
  1463.                            
  1464.                            
  1465. * C A U T I O N *
  1466.                            
  1467.      
  1468. See: CreateKXB  CopyDHXB  ZapKHXB
  1469. ~CreateKXB
  1470. Pack: CreateKeyPack     Src: CreateKXBsrc       Func:  20/Mid-level
  1471. Create a new BULLET key file. Before you can create a key file, you must first
  1472. have opened (and have created if necessary) the BULLET .DBF data file that it
  1473. is to index. (BULLET couples index and data files tightly.)
  1474. To create the key file, you need to provide the key expression, key flags, .DBF
  1475. file link handle, and optionally, the code page ID, country code, and collate
  1476. table.
  1477.                                 Key Expression
  1478. The key expression is an ASCII character string composed of the elements that
  1479. are to make up this index file's key. The key can be composed of any or all of
  1480. the fields in the .DBF data record or sub-strings within any of those fields.
  1481. Two functions are supported in evaluating a key expression. These are SUBSTR()
  1482. and UPPER(). SUBSTR() is similar to BASIC's MID$() in that it extracts part of
  1483. a string starting at a particular position for x number of characters. UPPER()
  1484. is similar to UCASE$() in that it converts all lower-case letters to their
  1485. upper-case equivalent. Since BULLET supports NLS, UPPER() conversion is not
  1486. required for proper sorting of mixed-case text strings.
  1487. See: CreateKXB_a  CreateDXB                                             -MORE-
  1488. ~CreateKXB_a
  1489. All names used in the key expression must be a valid field name in the DBF data
  1490. file. Some sample key expressions given that the .DBF has the following fields:
  1491.  Fields...             Valid key expressions
  1492.      
  1493.  FNAME C 25 0       kx = "LNAME"
  1494.  LNAME C 25 0       kx = "LNAME+FNAME"
  1495.  SSN   C  9 0       kx = "SUBSTR(LNAME,1,4)+SUBSTR(FNAME,1,1)+SUBSTR(SSN,6,4)
  1496.  DEPT  N  5 0       kx = "UPPER(LNAME+FNAME)"  (for non-NLS index files)
  1497.   :     :           kx = "DEPT+SSN" (N- + C-type is valid for non-binary keys)
  1498.                                     Key Flags
  1499. The key expression is used in conjunction with the key flags to determine the
  1500. type of key generated.
  1501. First, if your index file is to disallow duplicate keys, add 1 to KeyFlag.
  1502. If you have a key composed of a character field(s) or portions thereof, you
  1503. specify a KeyFlag = 2. This instructs BULLET that the sort order is left-to-
  1504. right (proper mixed-case sorting is available, see code page ID).
  1505. See: CreateKXB_b                                                        -MORE-
  1506. ~CreateKXB_b
  1507. If you have a key composed of a numeric field(s) or portions thereof, you can
  1508. also specify a KeyFlag = 2. This instructs BULLET to treat the numeric field
  1509. as a regular character field for sorting. To ensure proper sorting, you must
  1510. decimal-align the +numeric strings in the .DBF data field, i.e., right-justify
  1511. the numeric strings (dBASE .DBF numeric strings are stored as ASCII strings).
  1512. These non-binary numeric fields are just like character fields to BULLET.
  1513. In addition, if you have a key composed of a SINGLE numeric field (fld type N)
  1514. and the field is an integer (NO DECIMAL POINT), you can specify a KeyFlag of 16
  1515. or 32. KeyFlag=16 is for a field known to be in word/integer range; KeyFlag=32
  1516. if the field is known to be in LongInt range. These KeyFlag values instruct
  1517. BULLET to sort the key as a 16/32-bit BINARY value. It also stores the key as a
  1518. 16- or 32-bit value (only 2 or 4 bytes) in the index, eventhough the data field
  1519. is in ASCII (keyflag=16 or 32).
  1520. Although not dBASE compatible, you may use BINARY FIELDS in your data records.
  1521. dBASE always has ASCII data in the data fields, even if the field is numeric.
  1522. For example, an N type field of 8.2 is stored as an ASCII text string in the
  1523. data record, say, a string like " 1100.55". If you want dBASE compatibility
  1524. your field data must also be ASCII. However, if you can forgo this requirement,
  1525. you can use binary values in the fields.
  1526. See: CreateKXB_c                                                        -MORE-
  1527. ~CreateKXB_c
  1528. To do this you must specify a field type of "B" (actually, anything but a "N")
  1529. and, IF IT IS TO BE USED AS A KEY FIELD, also set the 16- or 32-bit KeyFlag.
  1530. Unique and signed may also be flagged. The field length for a "B" field type is
  1531. 2 or 4. Make sure the key flags match (2 if cINTEGER, 4 if cLONG).
  1532. If you specify a binary key flag (for either N or B field types), you must also
  1533. specify whether the field is to be treated as a signed or unsigned value. If
  1534. values less than 0 are possible, add to KeyFlag the hex number &H8000.
  1535.  KeyFlag = cUNIQUE + cCHAR              'unique character key (NLS sort)
  1536.  KeyFlag = cINTEGER + cUNIQUE           'unique unsigned integer (binary sort)
  1537.  KeyFlag = cUNIQUE + cSIGNED + cLONG    'unique signed long
  1538.  KeyFlag = cCHAR                        'character key with duplicates allowed
  1539.  KeyFlag = cCHAR + cINTEGER             'THIS IS AN INVALID KEY FLAGS!
  1540.  KeyFlag = cLONG                        'unsigned long (dups allowed)
  1541. The following values are defined in BULLET.BI (and BULLET.H):
  1542.   cUNIQUE=1, cCHAR=2, cINTEGER=&H10, cLONG=&H20, cNLS=&H4000, cSIGNED=&H8000
  1543. The NLS flag is assigned by BULLET. StatKXB is used to query KeyFlags.
  1544. See: CreateKXB_d                                                        -MORE-
  1545. ~CreateKXB_d
  1546. The key expression you specify may be up to 136 characters, and evaluate out to
  1547. 64 bytes (62 bytes if unique key is not specified). I.e, kx$ = "SUBSTR(..." can
  1548. be up to 136 characters, and that the actual key built from this expression can
  1549. be no longer that 64 bytes, or 62 if you did not specify UNIQUE. In general,
  1550. shorter keys (the key itself, not the expression) offer better performance.
  1551.                          DBF File Link Handle (XBlink)
  1552. Since BULLET evaluates the key expression at CreateKXB, it must have access to
  1553. the DBF file to verify that the key expression is valid. You must therefore
  1554. supply CreateKXB with the OS file handle of the opened DBF data file.
  1555. National Language Support (NLS)
  1556. With DOS 3.3 and later, NLS is available. BULLET uses NLS to build the collate
  1557. sequence table that it uses to ensure proper sorting of mixed-case keys as well
  1558. as the sorting of foreign language alphabets. In order for BULLET to use the
  1559. proper collate table, it must know what code page ID and coutry code to use.
  1560. This table is made part of the index file so that all subsequent access to the
  1561. index file maintains the original sort order, even if the MIS shop is moved to
  1562. another location/computer system using another country code/code page.
  1563. See: CreateKXB_e                                                        -MORE-
  1564. ~CreateKXB_e
  1565.                                 Code Page ID
  1566. To use the default code page ID of the computer in use, specify a code page ID
  1567. of -1. This instructs BULLET to use the collate-sequence table as provided by
  1568. MS-DOS running on the machine. You may also specify the code page ID for BULLET
  1569. to use, but only if support for the code page ID is available on your machine.
  1570. Look in your DOS manual under CUSTOMIZING FOR INTERNATIONAL USE for specific
  1571. code page IDs and country codes. See also the COUNTRY and NLSFUNC commands.
  1572. You may also specify a code page ID = 0 in which case no collate table is used.
  1573.                                 Country Code
  1574. To use the default country code of the computer in use, specify a country code
  1575. of -1. This instructs BULLET to use the collate-sequence table as provided by
  1576. MS-DOS running on the machine. You may also specify the country code for BULLET
  1577. to use, but only if support for the country code is available on your machine.
  1578. Look in your DOS manual under CUSTOMIZING FOR INTERNATIONAL USE for specific
  1579. code page IDs and country codes. See also the COUNTRY and NLSFUNC commands.
  1580. You may also specify a country code = 0 in which case no collate table is used.
  1581. Typically, you set CodePageID = -1, CoutryCode = -1 and CollatePtr = 0.
  1582. See: CreateKXB_f                                                        -MORE-
  1583. ~CreateKXB_f
  1584.                          User-specified Collate Table
  1585. If you are to use a MS-DOS supplied collate table (BOTH codepage ID and country
  1586. codes are non-zero) then you do not need to specify a collate table--DOS will.
  1587. The option to allow a user-specified collate table is to work around some DOS
  1588. versions supplying incorrect collate tables. If you find that the DOS-supplied
  1589. collate table is not valid (it's stored in the second sector of the file) for
  1590. your country, you can supply the table to be used by pointing the CollatePtr
  1591. variables to your in-memory version of a valid collate table. If you want to
  1592. use the DOS-supplied collate table, you MUST set the CollatePtr variables = 0.
  1593. Note: The collate table is a 256-byte table that contains the sort value of
  1594. each character (0-255). For example, the first byte would be 0, second would
  1595. be 1, and so on. Values for characters up to the lower-case letters (ASCII 97)
  1596. are usually as you would expect: "A" has a value of 65. However, the lower-case
  1597. letters have the same value as their upper-case counterparts: "a" also has a
  1598. value of 65. BULLET uses this collate table to ensure proper sorting.
  1599. If you specify EITHER code page ID OR country code = 0 then no collate table
  1600. is used or built. Instead, sorting is done by standard ASCII sort. This is
  1601. somewhat faster but less versatile. Use UPPER() for mixed-case sort if needed.
  1602. See: OpenKXB  CreateKXB
  1603. ~OpenKXB
  1604. Pack: OpenPack          Src: OpenKXBsrc         Func:  21/Mid-level
  1605. Open an existing key file for use.
  1606. Each key file that you open allocates 1264 bytes for internal use. This memory
  1607. is not deallocated until you close the file with CloseKXB or execute ExitXB.
  1608. You must open the data file before you can open its related index file
  1609. because you must supply the handle of the data file that this index files
  1610. indexes.
  1611. See: CloseKXB  OpenDXB
  1612. ~CloseKXB
  1613. Pack: HandlePack        Src: CloseKXBsrc        Func:  22/Mid-level
  1614. Close an open key file. Closing the file updates the file header and
  1615. deallocates the memory used by this file.
  1616. You MUST close all BULLET files before ending your program or file corruption
  1617. may occur. To ensure that all files are closed on the event of an unscheduled
  1618. program termination, use AtExitXB.                                           
  1619. See: StatKXB  ExitXB  CloseDXB
  1620. ~StatKXB
  1621. Pack: StatKeyPack       Src: StatKXBsrc         Func:  23/Mid-level
  1622. Get basic information on a BULLET key file handle specified. Information
  1623. returned includes the number of keys in the file, the key length, the data file
  1624. handle for this key, the last accessed record number of that data file, NLS
  1625. information, and the key flags.
  1626. Typically, your program will keep track of whether a particular handle belongs
  1627. to a key file or a data file. In cases where this is not possible, call the
  1628. StatHandleXB routine to determine what file type a handle is.
  1629. See: ReadKHXB  StatDXB  StatHandleXB
  1630. ~ReadKHXB
  1631. Pack: HandlePack        Src: ReadKHXBsrc        Func:  24/Mid-level
  1632. Reload the disk copy of the key header for the opened key file handle to the
  1633. internal copy.
  1634. In single-user, single-tasking systems this routine is not needed. However, in
  1635. a multi-user or multi-tasking system it's possible, and desirable, for two or
  1636. more programs to use the same data file. Consider this scenario: A key file has
  1637. 100 keys. Two programs access this key file, both opening it. Program 1 locks
  1638. the file, adds a new key, then flushes and unlocks the file. Program 1 knows
  1639. that there are now 101 keys in the file. However, Program 2 is not aware of the
  1640. changes that Program 1 made--it thinks that there are still 100 keys in the
  1641. file. This out-of-sync situation is easily remedied by having Program 2 reload
  1642. the key header from the file on disk.
  1643. How does Program 2 know that it needs to reload the header? It doesn't. Instead
  1644. BULLET uses a simple yet effective approach when dealing with such problems.
  1645. Whenever your program locks a file, BULLET automatically reloads the header.
  1646. Whenever you unlock a file, BULLET automatically flushes the header.
  1647. See: FlushKHXB  ReadDHXB  FlushDHXB  LockXB
  1648. ~FlushKHXB
  1649. Pack: HandlePack        Src: FlushKHXBsrc       Func:  25/Mid-level
  1650. Write the internal copy of the key header for the opened key file handle to
  1651. disk. The actual write occurs only if the header has been changed.
  1652. This is to ensure that the key header on disk matches exactly the key header
  1653. that is being maintained by BULLET. Also, this routine updates the operating
  1654. system's directory entry for this file.
  1655.      
  1656. Assume the following: A data file with 100 keys. Your program opens the key
  1657. file and adds 1 key. Physically, there are 101 keys on disk. However, the
  1658. header image of the data file on disk still reads 100 keys. This isn't a
  1659. problem, BULLET uses its internal copy of the key header and the internal copy
  1660. does read 101 keys. BUT, if there were a system failure now, the disk image
  1661. would not get updated. After the system restart, BULLET opens the file, reads
  1662. the header and thinks that there are 100 keys. You lost a key. Now, if after
  1663. that add above, your program issued a FlushKHXB, the header on disk is
  1664. refreshed with the internal copy, keeping the two in-sync. Also, the routine
  1665. updates the DOS directory entry, keeping things neat there as well. Still, it
  1666. doesn't come without cost: flushing will take additional time, therefore, you
  1667. may elect to flush periodically, or whenever the system is idle.
  1668. See: CopyKHXB  ReadKHXB  FlushDHXB  LockXB
  1669. ~CopyKHXB
  1670. Pack: CopyPack          Src: CopyKHXBsrc        Func:  26/Mid-level
  1671. Copy the key file structure of an open key file to another DOS file.
  1672. This routine makes it easy for you to duplicate the structure of an existing
  1673. key file without having to specify all the information needed by CreateKXB.
  1674. The resultant key file will be exactly like the source, including key flags and
  1675. key expression. It will contain 0 keys.
  1676.      
  1677. See: ZapKHXB  CopyKHXB
  1678. ~ZapKHXB
  1679. Pack: HandlePack        Src: ZapKHXBsrc         Func:  27/Mid-level
  1680. Delete all keys for a key file.
  1681. This routine is similar to CopyKHXB except for one major difference: ALL KEYS
  1682. IN THE *SOURCE* FILE ARE PHYSICALLY DELETED, so be *careful*.
  1683. If you have a key file with 100 keys and use ZapKHXB on it, all 100 keys will
  1684. be physically deleted and the file truncated to 0 keys. There is no return from
  1685. this routine. All data is gone.
  1686.                            
  1687.                            
  1688. * C A U T I O N *
  1689.                            
  1690.      
  1691. See: GetDescriptorXB  CopyKHXB  ZapDHXB
  1692. ~GetDescriptorXB
  1693. Pack: DescriptorPack    Src: GetDescriptorXBsrc Func:  30/Mid-level
  1694. Get the field descriptor information for a field.
  1695. You can specifiy either the fieldname or the field number (position of the
  1696. field within the record where the first field is #1) to get info on.
  1697. The field descriptor contains the following information:
  1698.   FIELDNAME  10 upper-case characters, A-Z and _ allowed, unused space is
  1699.              0-filled and is 0-terminated (11 bytes, ASCII, byte 11 always=0)
  1700.   FIELDTYPE  single ASCII character where C=character, N=numeric, D=date,
  1701.              L=logical, and M=memo field (1 byte, ASCII)
  1702.   FIELDLEN   length of field: C=1-254, N=1-19, D=8 (yyyymmdd), L=1 (T/F/space),
  1703.              M=10, this is total field length (1 byte, binary)
  1704.   FIELDDC    places right of decimal point if N field type, minimum if not 0 is
  1705.              2, can be up to 6 or 8, non-N fields always 0 (1 byte, binary)
  1706. See: GetRecordXB
  1707. ~GetRecordXB
  1708. Pack: AccessPack        Src: GetRecordXBsrc     Func:  31/Mid-level
  1709. Get the physical record from the data file into a data buffer by record number.
  1710. The data buffer is typically a TYPEd variable defined as the .DBF record itself
  1711. is defined. For example, if the DBF record has 2 fields, LNAME and FNAME, then
  1712. variable would be TYPEd as:
  1713.   TYPE RecBuffer
  1714.   tag AS STRING * 1             'the Xbase DBF delete flag (must be included)
  1715.   LastName AS STRING * 25       'same field length as the .DBF LNAME field
  1716.   FirstName AS STRING * 25      'same field length as the .DBF FNAME field
  1717.   END TYPE
  1718. This method of accessing the data file does not use any indexing. Therefore, it
  1719. typically is not used except for special purposes. The preferred method to
  1720. access the data is by one of the keyed Get() routines.
  1721. See: AddRecordXB  GetEqualXB
  1722. ~AddRecordXB
  1723. Pack: AccessPack        Src: AddRecordXBsrc     Func:  32/Mid-level
  1724. Append the record in the data buffer to the end of the DBF file.
  1725. This method of adding a record does not involve any indexing. It is typically
  1726. used to build a data file en masse and do the indexing after the entire .DBF 
  1727. file(s) has been built.                                                      
  1728. If you have several thousand data records to be added at once, this method of
  1729. building the DBF first and then using the ReindexXB routine is often faster
  1730. than using the InsertXB routine for each record to add.
  1731. The AddRecordXB is very fast. 400 recs/sec on an AT machine is typical. Over
  1732. 2000 recs/sec can be added on a fast 486 machine--that's 120,000 records added
  1733. per minute.
  1734. The record number used is determined by BULLET and it is returned in AP.RecNo.
  1735. See: UpdateRecordXB  InsertXB  ReindexXB
  1736. ~UpdateRecordXB
  1737. Pack: AccessPack        Src: UpdateRecordXBsrc  Func:  33/Mid-level
  1738. Write the updated data record to the the physical record number.
  1739. This method of writing the updated record must not be used if any field(s) in
  1740. the record is used as a key field(s) and has been changed.                   
  1741. This method of updating a record is very fast if you know that that update is
  1742. not going to alter any field used as a key in any index file that uses it. You
  1743. must, of course, first get the data record into the record buffer. Then you can
  1744. change it and write the update out to disk with this routine.
  1745. If you need to change a field(s) that is used as a key field or part of one,
  1746. use the UpdateXB routine. UpdateXB not only dynamically updates all related
  1747. index files if you change a key field, it also will undo any and all changes if
  1748. an error occurs in the transaction.
  1749. See: DeleteRecordXB  GetRecordXB  UpdateXB
  1750. ~DeleteRecordXB
  1751. Pack: AccessPack        Src: DeleteRecordXBsrc  Func:  34/Mid-level
  1752. Tag the record at the physical record number as being deleted.
  1753. This does not tag any in-memory copies of the record so be sure to mark any
  1754. such copies as being deleted yourself.                                     
  1755. The first byte of every .DBF record is reserved for the delete tag. This tag
  1756. is a space (ASCII 32) if the record is normal, or a * (ASCII 42) if it's marked
  1757. as being deleted. This delete tag is a reserved field in the DBF record and as
  1758. such is not defined as a formal field with a descriptor, etc. Make sure that
  1759. you define your in-memory buffers to reserve the first byte for the delete tag.
  1760. The Xbase DBF standard doesn't physically remove records marked as deleted from
  1761. the data file. It doesn't mark them as available/reusable either. To physically
  1762. remove records marked as deleted use PackRecordsXB.
  1763. Records can be temporarily marked as deleted then recalled to normal status.
  1764. The Key/Get routines (GetFirstXB, etc.) return the record number needed for
  1765. this routine after each access in AP.RecNo.
  1766. See: UndeleteRecordXB  PackRecordsXB
  1767. ~UndeleteRecordXB
  1768. Pack: AccessPack        Src: UndeleteRecordsrc  Func:  35/Mid-level
  1769. Tag the record at the physical record number as being normal (not deleted).
  1770. This does not tag any in-memory copies of the record so be sure to mark any
  1771. such copies as being normal yourself.                                      
  1772. The first byte of every .DBF record is reserved for the delete tag. This tag
  1773. is a space (ASCII 32) if the record is normal, or a * (ASCII 42) if it's marked
  1774. as being deleted. This delete tag is a reserved field in the DBF record and as
  1775. such is not defined as a formal field with a descriptor, etc. Make sure that
  1776. you define your in-memory buffers to reserve the first byte for the delete tag.
  1777. The Xbase DBF standard does not physically remove records marked as deleted
  1778. from the data file so you can "recall" then back to normal status as easily as
  1779. you marked them deleted.
  1780. See: PackRecordsXB  DeleteRecordXB
  1781. ~PackRecordsXB
  1782. Pack: AccessPack        Src: PackRecordsXBsrc   Func:  36/Mid-level
  1783. Rebuild the open DBF file by physically removing all records marked as deleted.
  1784. Packing occurs in place using the existing file. It's recommended that you   
  1785. use BackupFileXB to copy the current DBF file before using this routine in   
  1786. case of a failure during the pack process.                                   
  1787. The newly packed file is truncated to reflect the current, actual size.
  1788. If there are index files for this .DBF file, they MUST all be reindexed after
  1789. the pack process by using ReindexXB.
  1790. This routine dynamically allocates at least as many bytes as the length of   
  1791. the record. More if available.                                               
  1792. See: FirstKeyXB  DeleteRecordXB  BackupFileXB  ReindexXB
  1793. ~FirstKeyXB
  1794. Pack: AccessPack        Src: FirstKeyXBsrc      Func:  40/Mid-level
  1795. Retrieve the first key in index order from the index file.
  1796. This routine does not access the .DBF file and so does not retrieve the data 
  1797. record. What it does do is locate the first key of the index, returning it,  
  1798. and also returning the record number within the .DBF that the key indexes.   
  1799. To retrieve the data record you can use the GetRecordXB routine. The preferred
  1800. method, however, is to use the GetFirstXB.
  1801. The key returned includes an enumerator if a non-unique index file is involved.
  1802. The enumerator is a little-endian 16-bit value that serves to differentiate  
  1803. up to 65535 "identical", non-unique keys. It is attached to all keys of non- 
  1804. unique index files and occupies the last two bytes of the key.               
  1805. This routine is typically used to position the index file to the first key so
  1806. as to allow forward in-order access to the keys by using NextKeyXB.
  1807. See: EqualKeyXB  GetFirstXB  GetRecordXB
  1808. ~EqualKeyXB
  1809. Pack: AccessPack        Src: EqualKeyXBsrc      Func:  41/Mid-level
  1810. Search for the exact key in the index file.
  1811. This routine does not access the .DBF file and so does not retrieve the data 
  1812. record. What it does do is search for the key in the index, and if found,    
  1813. returns the record number within the .DBF that the key indexes. The key must 
  1814. be an exact match, including enumerator word if a non-unqiue index file.     
  1815. To retrieve the data record you can use the GetRecordXB routine. The preferred
  1816. method, however, is to use the GetEqualXB.
  1817. This routine will only find EXACT matches to the specified key (including the
  1818. enumerator if applicable). However, even if the exact key is not found in the
  1819. index file, the index file is positioned so that the next NextKeyXB retrieves
  1820. the key that would have followed the unmatched specified key. For example,
  1821. if the key to match was "KINGS" (a partial key in this case), EqualKeyXB would
  1822. return a key not found error. If you were to now do a NextKeyXB, the next key
  1823. would be returned, let's say it is "KINGSTON".
  1824. See: NextKeyXB  GetEqualXB  GetRecordXB
  1825. ~NextKeyXB
  1826. Pack: AccessPack        Src: NextKeyXBsrc       Func:  42/Mid-level
  1827. Retrieve the next key in index order from the index file.
  1828. This routine does not access the .DBF file and so does not retrieve the data 
  1829. record. What it does do is retreive the next key of the index, returning it, 
  1830. and also returning the record number within the .DBF that the key indexes.   
  1831. To retrieve the data record you can use the GetRecordXB routine. The preferred
  1832. method, however, is to use the GetNextXB.
  1833. The key returned includes an enumerator if a non-unique index file is involved.
  1834. This routine is typically called after the index file has first been positioned
  1835. to a known key using either FirstKeyXB or EqualKeyXB, or after a previous
  1836. NextKeyXB or even PrevKeyXB. What it basically does is get the key following
  1837. the current key, and then make that key the new current key.
  1838. See: PrevKeyXB  GetNextXB  GetRecordXB
  1839. ~PrevKeyXB
  1840. Pack: AccessPack        Src: PrevKeyXBsrc       Func:  43/Mid-level
  1841. Retrieve the previous key in index order from the index file.
  1842. This routine does not access the .DBF file and so does not retrieve the data 
  1843. record. What it does do is retreive the previous key of the index, returning 
  1844. it and also returning the record number within the .DBF that the key indexes.
  1845. To retrieve the data record you can use the GetRecordXB routine. The preferred
  1846. method, however, is to use the GetPrevXB.
  1847. The key returned includes an enumerator if a non-unique index file is involved.
  1848. This routine is typically called after the index file has first been positioned
  1849. to a known key using either LastKeyXB or EqualKeyXB, or after a previous
  1850. PrevKeyXB or even NextKeyXB. What it basically does is to get the key previous
  1851. the current key, and then make that key the new current key.
  1852. See: LastKeyXB  GetPrevXB  GetRecordXB
  1853. ~LastKeyXB
  1854. Pack: AccessPack        Src: LastKeyXBsrc       Func:  44/Mid-level
  1855. Retrieve the last key in index order from the index file.
  1856. This routine does not access the .DBF file and so does not retrieve the data 
  1857. record. What it does do is locate the last key of the index, returning it,   
  1858. and also returning the record number within the .DBF that the key indexes.   
  1859. To retrieve the data record you can use the GetRecordXB routine. The preferred
  1860. method, however, is to use the GetLastXB.
  1861. This routine is typically used to position the index file to the last key so as
  1862. to allow reverse in-order access to the keys by using PrevKeyXB.
  1863. See: StoreKeyXB  GetLastXB  GetRecordXB
  1864. ~StoreKeyXB
  1865. Pack: AccessPack        Src: StoreKeyXBsrc      Func:  45/Mid-level
  1866. Insert the key into the index file in proper key order.
  1867. This routine does not add the data record to the .DBF file. It only inserts  
  1868. the key and record number into the index file. Use InsertXB, instead.        
  1869. To do a complete data record and key insert, you could use AddRecordXB to add
  1870. the data record to the .DBF, BuildKeyXB to construct the key, then StoreKeyXB
  1871. to insert the key and record number information into the index file. If that
  1872. key already exists and the file allows duplicate keys, you need to attach the
  1873. proper enumerator word and retry StoreKeyXB.
  1874. This is much too much to do. Instead, just use InsertXB. All these details
  1875. including adding the data record and multi-key inserts are performed
  1876. automatically with just the single call.
  1877. See: DeleteKeyXB  InsertXB
  1878. ~DeleteKeyXB
  1879. Pack: AccessPack        Src: DeleteKeyXBsrc     Func:  46/Mid-level
  1880. Physically remove the specified key from the index file.
  1881. This routine requires an EXACT key match for all bytes of the key, including 
  1882. the enumerator word if a non-unique index file is involved.                  
  1883. This routine would seldom be used, typically, since deleted dBASE data records
  1884. are only physically deleted during a PackRecordsXB and the index file is
  1885. rebuilt afterward using ReindexXB.
  1886. See: BuildKeyXB  CurrentKeyXB
  1887. ~BuildKeyXB
  1888. Pack: AccessPack        Src: BuildKeyXBsrc      Func:  47/Mid-level
  1889. Build the key for the specifed data record based on the key expression for the
  1890. index file. If the index file is non-unique, a 0-value enumerator is attached.
  1891. The enumerator is a little-endian 16-bit value that serves to differentiate  
  1892. up to 65535 "identical", non-unique keys. It is attached to all keys of non- 
  1893. unique index files and occupies the last two bytes of the key.               
  1894. This routine, like most of the mid-level routines, typically would not be used
  1895. since the high-level access routines take care of this detail automatically.
  1896. See: CurrentKeyXB  StoreKeyXB
  1897. ~CurrentKeyXB
  1898. Pack: AccessPack        Src: CurrentKeyXBsrc    Func:  48/Mid-level
  1899. Retrieve the current key value for the specified key file handle and also the
  1900. data record number that it indexes.
  1901. This routine is useful in that it retrieves on demand the actual key value of
  1902. the last accessed key in the index file (and the data record number). Most
  1903. often you don't need this information so it would be a waste of time and space
  1904. for your program to explicitly track each current key for each index file that
  1905. you have open.
  1906. See: GetFirstXB  ReindexXB  DeleteKeyXB
  1907. ~GetFirstXB
  1908. Pack: AccessPack        Src: GetFirstXBsrc      Func:  60/High-level
  1909. Retrieve the first indexed key and data record.
  1910. The key returned includes an enumerator if a non-unique index file is involved.
  1911. This routine is typically used to process a database in index order starting at
  1912. the first ordered key (and its data record). After processing this first entry,
  1913. subsequent in-order access of the database is achieved by using GetNextXB until
  1914. the end of the database is reached.
  1915. This routine, like all the high-level Get routines, fills in the AP.RecNo of
  1916. the record accessed. In GetFirstXB's case, it fills AP.RecNo with the record
  1917. number pointed to by the first key. Since this is so, the AP pack is primed for
  1918. an UpdateXB after each high-level Get. Other methods to get the record number
  1919. are to use CurrKeyXB or any of the Key routines (KeyFirstXB, etc.).
  1920. See: GetEqualXB  FirstKeyXB  UpdateXB
  1921. ~GetEqualXB
  1922. Pack: AccessPack        Src: GetEqualXBsrc      Func:  61/High-level
  1923. Search for the exact key in the index file and return its data record.
  1924. This routine will only find EXACT matches to the specified key (including the
  1925. enumerator if applicable). However, even if the exact key is not found in the
  1926. index file, the index file is positioned so that the next GetNextXB retrieves
  1927. the key that would have followed the unmatched specified key. For example,
  1928. if the key to match was "KINGS" (a partial key in this case), GetEqualXB would
  1929. return a key not found error. If you were to now do a GetNextXB, the next key
  1930. and data record would be returned, let's say the key is "KINGSTON" and its data
  1931. record is the data record for that key. Another GetNextXB would retrieve the
  1932. key and record after that. (GetPrevXB can be used in this fashion too.)
  1933. This routine, like all the high-level Get routines, fills in the AP.RecNo of
  1934. the record accessed. In GetEqualXB's case, it fills AP.RecNo with the record
  1935. number pointed to by the matched key. Since this is so, the AP pack is primed
  1936. for an UpdateXB after each high-level Get. Other methods to get the record
  1937. number are to use CurrKeyXB or any of the Key routines (KeyEqualXB, etc.).
  1938. See: GetNextXB  EqualKeyXB
  1939. ~GetNextXB
  1940. Pack: AccessPack        Src: GetNextXBsrc       Func:  62/High-level
  1941. Retrieve the next indexed key and its data record.
  1942. The key returned includes an enumerator if a non-unique index file is involved.
  1943. This routine is typically calld after the index file has first been positioned
  1944. to a known key using either GetFirstXB or GetEqualXB, or after a previous
  1945. GetNextXB or even GetPrevXB. What it basically does is get the key and data
  1946. record following the current key, and then make that key the new current key.
  1947. This routine, like all the high-level Get routines, fills in the AP.RecNo of
  1948. the record accessed. In GetNextXB's case, it fills AP.RecNo with the record
  1949. number pointed to by the next key. Since this is so, the AP pack is primed for
  1950. an UpdateXB after each high-level Get. Other methods to get the record number
  1951. are to use CurrKeyXB or any of the Key routines (KeyNextXB, etc.).
  1952. See: GetPrevXB  NextKeyXB
  1953. ~GetPrevXB
  1954. Pack: AccessPack        Src: GetPrevXBsrc       Func:  63/High-level
  1955. Retrieve the previous indexed key and record.
  1956. The key returned includes an enumerator if a non-unique index file is involved.
  1957. This routine is typically called after the index file has first been positioned
  1958. to a known key using either GetLastXB or GetEqualXB, or after a previous
  1959. GetPrevXB or even GetNextXB. What it basically does is to get the key and data
  1960. record previous the current key, and then make that key the new current key.
  1961. This routine, like all the high-level Get routines, fills in the AP.RecNo of
  1962. the record accessed. In GetPrevXB's case, it fills AP.RecNo with the record
  1963. number pointed to by the previous key. Since this is so, the AP pack is primed
  1964. for an UpdateXB after each high-level Get. Other methods to get the record
  1965. number are to use CurrKeyXB or any of the Key routines (KeyPrevXB, etc.).
  1966. See: GetLastXB  PrevKeyXB
  1967. ~GetLastXB
  1968. Pack: AccessPack        Src: GetLastXBsrc       Func:  64/High-level
  1969. Retrieve the last indexed key and record.
  1970. This routine is typically used to process a database in reverse index order
  1971. starting at the last ordered key (and its data record). After processing this
  1972. last entry, subsequent reverse-order access of the database is achieved by
  1973. using GetPrevXB until the top of the database is reached.
  1974. This routine, like all the high-level Get routines, fills in the AP.RecNo of
  1975. the record accessed. In GetLastXB's case, it fills AP.RecNo with the record
  1976. number pointed to by the last key. Since this is so, the AP pack is primed for
  1977. an UpdateXB after each high-level Get. Other methods to get the record number
  1978. are to use CurrKeyXB or any of the Key routines (KeyLastXB, etc.).
  1979. See: InsertXB  LastKeyXB
  1980. ~InsertXB
  1981. Pack: AccessPack        Src: InsertXBsrc        Func:  65/High-level
  1982. Add the data record to data file and insert the related key(s) into the linked
  1983. index file(s).
  1984. This routine is used to add new entries into a database, one at a time. The
  1985. data record is first added to the data file, then for each related index file,
  1986. a key is inserted into the appropriate index file. Up to 32 index files can be
  1987. automatically maintained for each data file.
  1988. This and several other routines are transaction-based. If a failure occurs
  1989. prior to the routine's completion, all changes made to the database by the
  1990. routine will be backed-out and the database (data and related index file(s))
  1991. effectively restored to its original state.
  1992.                                   
  1993. If the routine failed to complete, the function return value is the number of
  1994. the pack that caused the failure. The pack's Stat is checked to determine the
  1995. error code. If the function return value is 0, YOU MUST STILL check the first
  1996. pack's Stat. If it's non-zero, then the failure occured with the data record.
  1997. See: UpdateXB  StoreKeyXB
  1998. ~UpdateXB
  1999. Pack: AccessPack        Src: UpdateXBsrc        Func:  66/High-level
  2000. Modify an existing data record (identified by record number) and automatically
  2001. perform any index file updates needed to keep the index file(s) in sync.
  2002. If any key fields changed between the original record and the new one, this
  2003. routine updates the appropriate index file(s) by replacing the original key(s)
  2004. with new the key(s) based on the updated data record. Up to 32 index files can
  2005. be automatically maintained for each data file. Get routines (GetFirstXB, etc.)
  2006. set the AP.RecNo of the record that UpdateXB uses.
  2007. This and several other routines are transaction-based. If a failure occurs
  2008. prior to the routine's completion, all changes made to the database by the
  2009. routine will be backed-out and the database (data and related index file(s))
  2010. effectively restored to its original state.
  2011. If the routine failed to complete, the function return value is the number of
  2012. the pack that caused the failure. The pack's Stat is checked to determine the
  2013. error code. If the function return value is 0, YOU MUST STILL check the first
  2014. pack's Stat. If it's non-zero, then the failure occured with the data record.
  2015. See: ReindexXB  UpdateRecordXB
  2016. ~ReindexXB
  2017. Pack: AccessPack        Src: ReindexXBsrc       Func:  67/High-level
  2018. Reindex all related index files for a data file.
  2019. The index file(s) must already exist and be open. Any existing key data is
  2020. overwritten by the new key data. In other words, if you have a 10MByte index
  2021. file, ReindexXB uses the same file space building the news keys over the old.
  2022. This results in a less fragmented disk and also minimizes disk space needed.
  2023. You can also create a new, empty index file and reindex to that. This would be
  2024. useful, for instance, if you needed to create a temporary index file--something
  2025. that you'd use for a report, say, then delete after the report.
  2026. This routine creates a TEMPORARY work file in either the current directory or,
  2027. if the DOS environment variable TMP is defined, in the TMP= directory. The size
  2028. of this file is approx. bytes = (RECORDS * (KEYLEN+6)). ReindexXB can operate
  2029. in as little as 32K of available memory and can use up to 128K. The resultant
  2030. index file(s) are optimized for minimum size AND maximum retrieval speed.
  2031. If the routine failed to complete, the function return value is the number of
  2032. the pack that caused the failure. The pack's Stat is checked to determine the
  2033. error code. A return value of zero indicates no error occured.               
  2034. See: LockXB  PackRecordsXB
  2035. ~LockXB
  2036. Pack: AccessPack        Src: LockXBsrc          Func:  80/Network
  2037. Lock all bytes in the index file handle(s) for exclusive use by the current
  2038. process and reload the index file header(s) from disk. Also lock all bytes in
  2039. the related data file and reload the data file header from disk.
  2040. The files must have been opened with the appropriate share attribute and not 
  2041. in compatibility mode. SHARE.EXE MUST be installed or DOS error 1 is issued. 
  2042. This routine is transaction-based and will lock all index files specified in 
  2043. AccessPack and the data file. If any lock fails, all previous locks by this  
  2044. routine are released. The return value indicates which access pack failed, if
  2045. any. This value is used as the index into the AccessPack group for you to    
  2046. identify the error code. See LockXBsrc for determining this exactly.         
  2047. Use the DriveRemoteXB and/or FileRemoteXB to determine if locking is necessary.
  2048. If the files are on a remote drive then it is best to use locking. Locking may
  2049. also be necessary on multitasking local machines accessing shared files.
  2050. This routine is a combination of LockKeyXB and LockDataXB.
  2051. See: UnlockXB  LockKeyXB  LockDataXB  DriveRemoteXB  FileRemoteXB
  2052. ~UnlockXB
  2053. Pack: AccessPack        Src: UnlockXBsrc        Func:  81/Network
  2054. Unlock all bytes in the specified file handle(s) (previously locked) and flush
  2055. the file header(s) to disk (flush done before lock(s) released). Also unlock
  2056. all bytes in the related data file and flush the data file header to disk.
  2057. The files must have been opened with the appropriate share attribute and not 
  2058. in compatibility mode. SHARE.EXE MUST be installed or DOS error 1 is issued. 
  2059. This routine is transaction-based and will unlock all index files specified in
  2060. AccessPack and the data file. If an unlock fails the routine exits with a
  2061. return value indicating which access pack failed. This value is used as the
  2062. index into the AccessPack group for you to identify the error code. Note that
  2063. this routine does not attempt to re-lock those files unlocked successfully if
  2064. an error occurs in the transaction. If an error does occur (unlikely) you will
  2065. need to provide for unlocking the remaining files manually with the UnlockKeyXB
  2066. and UnlockDataXB routines. You should not rely on the operating system to
  2067. automatically unlock files when they're closed.
  2068. This routine is a combination of UnlockKeyXB and UnlockDataXB.
  2069. See: LockKeyXB  UnlockKeyXB  UnlockDataXB
  2070. ~LockKeyXB
  2071. Pack: AccessPack        Src: LockKeyXBsrc       Func:  82/Network
  2072. Lock all bytes in the index file handle(s) for exclusive use by the current
  2073. process and reload the index file header(s) from disk.
  2074. The files must have been opened with the appropriate share attribute and not 
  2075. in compatibility mode. SHARE.EXE MUST be installed or DOS error 1 is issued. 
  2076. This routine is transaction-based and will lock all index files specified in
  2077. AccessPack. If any lock fails, all previous locks by this routine are released.
  2078. The return value indicates which access pack failed, if any. This value is used
  2079. as the index into the AccessPack group for you to identify the error code.
  2080. The advantage of using region locks (LockKeyXB locks the entire file region) to
  2081. control file access is that the file does not need to be opened/closed using
  2082. the Deny Read/Write sharing attribute. Opening the file for Deny None, and
  2083. controlling subsequent access with region locks, allows for faster processing
  2084. since files do not need to be constantly opened and closed, as they would if
  2085. access were controlled by opening with Deny Read/Write.
  2086. See: UnlockKeyXB  LockXB
  2087. ~UnlockKeyXB
  2088. Pack: AccessPack        Src: UnlockKeyXBsrc     Func:  83/Network
  2089. Unlock all bytes in the specified file handle(s) (previously locked) and flush
  2090. the file header(s) to disk (flush done before lock(s) released).
  2091. The files must have been opened with the appropriate share attribute and not 
  2092. in compatibility mode. SHARE.EXE MUST be installed or DOS error 1 is issued. 
  2093. This routine is transaction-based and will unlock all index files specified in
  2094. AccessPack. If an unlock fails the routine exits with a return value indicating
  2095. which access pack failed. This value is used as the index into the AccessPack
  2096. group for you to identify the error code.
  2097. All file locks should be released when exclusive access in no longer needed. 
  2098. It is not recommended that you end your program without having released active
  2099. file locks. This is especially a valid concern for DOS versions prior to 5.0.
  2100. DOS 5 releases locks on files that are closed.
  2101. See: LockDataXB  UnlockXB
  2102. ~LockDataXB
  2103. Pack: AccessPack        Src: LockDataXBsrc      Func:  84/Network
  2104. Lock all bytes in the file handle's data file for exclusive use by the current
  2105. process and reload the data file header from disk. You must set AP.RecNo=0 to
  2106. do this. To lock a single record, set AP.RecNo=record# to lock.
  2107. The files must have been opened with the appropriate share attribute and not 
  2108. in compatibility mode. SHARE.EXE MUST be installed or DOS error 1 is issued. 
  2109. This routine locks the specified data file. If the handle specified is that of
  2110. an index file, that index file's related data file handle is used. For single-
  2111. record locks, AP.Handle must have a data file handle specified. Header loading
  2112. is not performed if locking a single record.
  2113. The advantage of using region locks (LockDataXB locks the entire file region)
  2114. to control file access is that the file does not need to be opened/closed using
  2115. the Deny Read/Write sharing attribute. Opening the file for Deny None, and
  2116. controlling subsequent access with region locks, allows for faster processing
  2117. since files do not need to be constantly opened and closed, as they would if
  2118. access were controlled by opening with Deny Read/Write.
  2119. See: UnlockDataXB
  2120. ~UnlockDataXB
  2121. Pack: AccessPack        Src: UnlockDataXBsrc    Func:  85/Network
  2122. Unlock all bytes in the specified file handle (previously locked) and flush the
  2123. data file header to disk (flush done before lock released). To do this you must
  2124. set AP.RecNo=0. To unlock a single record, set AP.RecNo=record# to unlock.
  2125. The files must have been opened with the appropriate share attribute and not 
  2126. in compatibility mode. SHARE.EXE MUST be installed or DOS error 1 is issued. 
  2127. This routine unlocks the specified data file. If the handle specified is that
  2128. of an index file that index file's related datafile handle is used. For single-
  2129. record unlocks, AP.Handle must have a data file handle specified. Flushing is
  2130. not performed if unlocking a single record.
  2131. All file locks should be released when exclusive access in no longer needed. 
  2132. It is not recommended that you end your program without having released active
  2133. file locks. This is especially a valid concern for DOS versions prior to 5.0.
  2134. DOS 5 releases locks on files that are closed.
  2135. See: DriveRemoteXB
  2136. ~DriveRemoteXB
  2137. Pack: RemotePack        Src: DriveRemoteXBsrc   Func:  86/Network
  2138. Determine if specified drive is remote (default drive=0, A:=1, B=2, C=3...).
  2139. This routine uses INT21/44/sub function 09.
  2140. In addition to returning the IsRemote state, this routine sends back the result
  2141. of the DX register and also the install state of SHARE.EXE.
  2142. The meaning of the bitflags in Flags are (where IsRemote=0):
  2143. Bit   Meaning drive...
  2144.  1   1=uses 32-bit sectoring
  2145.  6   1=accepts Generic IOCTL (for INT21/44/0D,0E,0Fh)
  2146.  7   1=accepts Query IOCTL Device (INT21/44/11h)
  2147.  9   1=is local but shared by other computers in the network
  2148. 11   1=accepts Does-Device-Use-Removable-Media (INT21/44/08)
  2149. 13   1=requires media descriptor in FAT
  2150. 14   1=accepts Receive/Send Control Data from Block Device (INT21/44/04,05)
  2151. 15   1=is Substitution drive (set by the DOS SUBST command)
  2152.      (all other bits=0)
  2153. See: FileRemoteXB  LockXB
  2154. ~FileRemoteXB
  2155. Pack: RemotePack        Src: FileRemoteXBsrc    Func:  87/Network
  2156. Determine if specified handle of file or device is remote.
  2157. This routine uses INT21/44/sub function 0Ah.
  2158. In addition to returning the IsRemote state, this routine sends back the result
  2159. of the DX register and also the install state of SHARE.EXE.
  2160. Flags bit 7=1 then handle is device, =0 then handle is file.
  2161. Bit   Meaning DEVICE...                 Bit   Meaning DEVICE...(cont)
  2162.  0   1=is console input device          13   1=is named pipe
  2163.  1   1=is console output device         15   1=is remote, 0=is local
  2164.  2   1=is null device                        (all other bits=0)
  2165.  3   1=is clock device                  Bit   Meaning FILE...
  2166.  4   1=is special device               0-5   xxxxxx=drive number (0=A...)
  2167.  5   1=is in binary mode, 0=in ASCII     6   1=has not been written to
  2168.  6   0=returns EOF if device is read    12   1=is NoInherit
  2169. 11   1=is network spooler               14   1=date/time not set at close
  2170. 12   1=is NoInherit                     15   1=is remote, 0=is local
  2171.                                              (all other bits=0)
  2172. See: SetRetriesXB  DriveRemoteXB  LockXB
  2173. ~SetRetriesXB
  2174. Pack: SetRetriesPack    Src: SetRetriesXBsrc    Func:  88/Network
  2175. Set the number of times DOS retries disk operations after a failure due to
  2176. file-sharing operations (locked file regions from LockXB routines).
  2177. This routine uses INT21/44/sub function 0Bh.
  2178. By default DOS retries an operation 3 times (without pausing between attempts)
  2179. before returning an error to the application.
  2180. If you change the default values it's recommended that the default state be  
  2181. restored before your application ends (Retries=3, Pause=1).                  
  2182. These values are pretty much determined by trial-and-error. You may find that
  2183. adding a delay between retries returns fewer access-denied errors.
  2184. See: DeleteFileDOS  LockXB
  2185. ~DeleteFileDOS
  2186. Pack: DOSFilePack       Src: DeleteFileDOSsrc   Func: 100/DOS
  2187. Delete the specified file.
  2188. This routine uses DOS INT21/41 (interrupt 21h function 41h).
  2189. See: RenameFileDOS
  2190. ~RenameFileDOS
  2191. Pack: DOSFilePack       Src: RenameFileDOSsrc   Func: 101/DOS
  2192. Rename a file. May also be used to move the file to a new directory within the
  2193. partition.
  2194. This routine uses DOS INT21/56.
  2195. If the specified directory differs from the file's directory, the file's     
  2196. directory entry is moved to the new directory.                               
  2197. For example, if the FilenamePtr filename is C:\LP100\PROJ93A.INF and the
  2198. NewFilenamePtr filename is C:\ARCH\PROJ93A.INA, the file is essentially
  2199. renamed and also moved to the \ARCH directory.
  2200. See: CreateFileDOS
  2201. ~CreateFileDOS
  2202. Pack: DOSFilePack       Src: CreateFileDOSsrc   Func: 102/DOS
  2203. Create a new file.
  2204. This routine uses INT21/3C.
  2205. The specified filename/pathname must NOT already exist.
  2206. The file created is not left open. You must OpenFileDOS to use it.
  2207. The attribute used during the create can be:
  2208.   ATTRIBUTE       VALUE    MEANING
  2209.    Normal              0    normal access permitted to file
  2210.    Read-Only           1    read-only access permitted to file
  2211.    Hidden              2    file does not appear in directory listing
  2212.    System              4    file is a system file
  2213.    Volume              8    FILENAME used as volume label if no current label
  2214.    Archive            20h   file is marked for archiving
  2215. See: AccessFileDOS  OpenFileDOS
  2216. ~AccessFileDOS
  2217. Pack: DOSFilePack       Src: AccessFileDOSsrc   Func: 103/DOS
  2218. Determine if the specified file can be accessed with the specified
  2219. access/sharing mode.
  2220. This routine uses INT21/3D and INT21/3E.
  2221. Basically, a Does-File-Exist routine. It uses the specified access/sharing
  2222. attributes when trying to open the file. For example, if you specify
  2223. DFP.Attr = &H42 (R/W access + Deny None sharing) and use AccessFileDOS on a
  2224. Read-Only DOS file, the return value would be DOS error 5, Access Denied.
  2225. See: OpenFileDOS
  2226. ~OpenFileDOS
  2227. Pack: DOSFilePack       Src: OpenFileDOSsrc     Func: 104/DOS
  2228. Open the specified file with the specified access/sharing mode.
  2229. This routine uses INT21/3D.
  2230.   ACCESS          VALUE    MEANING
  2231.    Read-only           0    open for read-only access
  2232.    Write-only          1    open for write-only access
  2233.    Read/Write          2    open for read/write access
  2234.   SHARE
  2235.    Compatibility       0     any process may share file (not recommended)
  2236.    Deny Read/Write    10h    no other process may share file
  2237.    Deny Write         20h    no other process may share file for write
  2238.    Deny Read          30h    no other process may share file for read
  2239.    Deny None          40h    any process may share file except in Compatibilty
  2240.   INHERIT                                                                 mode
  2241.    NoInheritFlag      80h    if set child processes do not inherit file handles
  2242.                              (child process cannot inherit handle > 20)
  2243. The file access mode is a combination of ACCESS + SHARE + INHERIT.
  2244. See: SeekFileDOS  OpenPack
  2245. ~SeekFileDOS
  2246. Pack: DOSFilePack       Src: SeekFileDOSsrc     Func: 105/DOS
  2247. Position the DOS file pointer of the specified file to the specified position.
  2248. This routine uses INT21/42.
  2249. The position is a 32-bit value and is relative to either the start of the file,
  2250. the current file pointer position, or the end of the file.
  2251.  Method  Meaning
  2252.     0    start move from the start of file (offset is a 32-bit unsigned value)
  2253.     1    start move at the current position (offset a signed value)
  2254.     2    start move at the end of file (offset a signed value)
  2255. For example, to move to the 511th byte of a file (byte 0 being the first), set
  2256. the offset value to 511 and use Method 0. On return, the absolute offset value
  2257. of the new position is returned. This is useful with Method 2 since you can
  2258. specify an offset of 0 and have the file length returned.
  2259. Never position the file pointer to before the start of file.                 
  2260. See: ReadFileDOS
  2261. ~ReadFileDOS
  2262. Pack: DOSFilePack       Src: ReadFileDOSsrc     Func: 106/DOS
  2263. Read from the file or device the specified number of bytes into a buffer.
  2264. This routine uses INT21/3F.
  2265. On block devices (such as disks) input starts at the current file position and
  2266. the file pointer is repositioned to the last byte read +1.
  2267. It is possible to read less than the bytes specified without an error being  
  2268. generated. Compare the bytes to read with the returned bytes read value. If  
  2269. less then end of file was reached during the read, if 0 then file was at EOF.
  2270. By using DOS's predefined handles you can read from the keyboard (STDIN) by
  2271. using the STDIN handle, 0. The input will terminate after all specified bytes
  2272. have been read or after a CR (ASCII 0Dh). If more bytes are entered than were
  2273. requested, the next read will retrieve those excess bytes. Therefore, it's
  2274. suggested that you specify 129 bytes to input (DOS will process 127+CR/LF bytes
  2275. maximum when reading the STDIN device). Post-process the entered data by
  2276. scanning for the CR/LF.
  2277. See: ExpandFileDOS
  2278. ~ExpandFileDOS
  2279. Pack: DOSFilePack       Src: ExpandFileDOSsrc   Func: 107/DOS
  2280. Expands the specified file by the specified number of bytes.
  2281. This routine uses INT21/42 and INT21/40.
  2282. This routine is useful in pre-allocating disk space. By reserving disk space in
  2283. advance you can guarantee that enough disk space will be available for a future
  2284. operation (especially if more than 1 process is running). You'll also be able
  2285. ensure that the disk space that a file does use is as contiguous as possible.
  2286. Database systems are dynamic and their files typically allocate new space on
  2287. an as-needed basis. This dynamic allocation can cause parts of a file to be
  2288. located throughout the disk system, possibly affecting performance drastically.
  2289. By pre-allocating the disk space you can be assured of consistent throughput
  2290. performance since the file is contiguous.
  2291. See: WriteFileDOS
  2292. ~WriteFileDOS
  2293. Pack: DOSFilePack       Src: WriteFileDOSsrc    Func: 108/DOS
  2294. Write to the file or device the specified number of bytes from a buffer.
  2295. This routine uses INT21/40.
  2296. If the number of bytes written is less than the specified bytes, this routine
  2297. returns a -2 error code (or 65554 unsigned).                                 
  2298. On block devices (such as disk) output starts at the current file position, and
  2299. the file pointer is repositioned to the last byte written +1.
  2300. If the specified bytes to write is 0, the file is truncated at the current   
  2301. file pointer position.                                                       
  2302. By using DOS's predefined handles you can write to the screen (STDOUT) by
  2303. using the STDOUT handle, 1.
  2304. See: CloseFileDOS
  2305. ~CloseFileDOS
  2306. Pack: DOSFilePack       Src: CloseFileDOSsrc    Func: 109/DOS
  2307. Close the file flushing any internal buffers, releasing any locked regions, and
  2308. update the directory entry to the correct size, date, and time.
  2309. This routine uses INT21/3E.
  2310. If you have opened a file using the DOS open routine you should close it when
  2311. you no longer need it.
  2312. This routine can be used to close the predefined DOS handles (0-4) and make  
  2313. those handles available for reuse. Typically handles 0 and 1 should not be   
  2314. closed by an application since they are the STDIN and STDOUT that DOS uses   
  2315. for the current application (keyboard and screen).                           
  2316. Since BULLET provides for up to 250 user file handles for your applications it
  2317. isn't necessary for you to eek 3 more file handles by closing handles 2-4.
  2318. See: MakeDirDOS
  2319. ~MakeDirDOS
  2320. Pack: DOSFilePack       Src: MakeDirDOSsrc      Func: 110/DOS
  2321. Create a new subdirectory.
  2322. This routine uses INT21/39.
  2323. See: DeleteFileDOS
  2324. ~AccessPack
  2325.  Src: InsertXBsrc      Func: InsertXB and many more
  2326. TYPE AccessPack        'AP (AP is recommended pack name for DIM, AP.Func=)
  2327. Func AS INTEGER        'varies
  2328. Stat AS INTEGER        'ret:completion status
  2329. Handle AS INTEGER      'OS handle
  2330. RecNo AS LONG          ' in:rec number to get/delete/update (if applicable)
  2331.                        ' in:set to single rec# to lock or set to 0 to lock all
  2332.                        'ret:record number of data record accessed
  2333. RecPtrOff AS INTEGER   'far pointer to record storage buffer
  2334. RecPtrSeg AS INTEGER
  2335. KeyPtrOff AS INTEGER   'far pointer to search key buffer
  2336. KeyPtrSeg AS INTEGER
  2337. NextPtrOff AS INTEGER  'far pointer to next key access pack
  2338. NextPtrSeg AS INTEGER  'or 0:0 if end of link or if N/A
  2339. END TYPE  '22
  2340. The NextPtr variables are only used by InsertXB, UpdateXB, ReindexXB, and the
  2341. LockXB routines. NextPtr is used as a link to the next related access pack,
  2342. if any. Not all entries are used by all routines. Generally, any routine that
  2343. gets/puts user data to the database uses this pack.
  2344. See: BreakPack
  2345. ~BreakPack
  2346.  Src: BreakXBsrc       Func: BreakXB
  2347. TYPE BreakPack             'BP
  2348. Func AS INTEGER            '4
  2349. Stat AS INTEGER            'ret:completion status
  2350. Mode AS INTEGER            '=0 disable Ctrl-C/Ctrl-Break, 1=restore
  2351. END TYPE '6 bytes
  2352. A simple pack.
  2353. See: CopyPack
  2354. ~CopyPack
  2355.  Src: BackupFileXBsrc  Func: BackupFileXB, CopyDHXB, CopyKHXB
  2356. TYPE CopyPack              'CP
  2357. Func AS INTEGER            '5=BackupFileXB,16=CopyDHXB,26=CopyKHXB
  2358. Stat AS INTEGER            'ret:completion status
  2359. Handle AS INTEGER          'handle of BULLET file
  2360. FilenamePtrOff AS INTEGER  'far pointer to filenameZ
  2361. FilenamePtrSeg AS INTEGER  '(filename must end with a CHR$(0)))
  2362. END TYPE '10
  2363. See: CreateDataPack
  2364. ~CreateDataPack
  2365.  Src: CreateDXBsrc     Func: CreateDXB
  2366. TYPE CreateDataPackTYPE    'CDP
  2367. Func AS INTEGER            '10
  2368. Stat AS INTEGER            'ret:completion status
  2369. FilenamePtrOff AS INTEGER  'far pointer to filenameZ to create
  2370. FilenamePtrSeg AS INTEGER  '(filename must end with a CHR$(0))
  2371. NoFields AS INTEGER        'number of fields per record
  2372. FieldListPtrOff AS INTEGER 'far pointer to field list
  2373. FieldListPtrSeg AS INTEGER '(field list is of type FieldDescTYPE )
  2374. FileID AS INTEGER          'file signature byte, usually=3
  2375. END TYPE '16
  2376. The filename pointed at by the FilenamePtr variables should be a fixed-length
  2377. string (e.g., FILEN AS STRING * 80) so that VARSEG/VARPTR can be used to get
  2378. its memory address. The filename must end with a CHR$(0) immediately following
  2379. the last character of the filename: FILEN = YourFilename$ + CHR$(0).
  2380. The FieldListPtr variables point to an array of type FieldDescTYPE. This array
  2381. is dimensioned for as many fields as there are in the record and contains the
  2382. field descriptors, one for each field.
  2383. See: CreateKeyPack  FieldDescTYPE
  2384. ~CreateKeyPack
  2385.  Src: CreateKXBsrc     Func: CreateKXB
  2386. TYPE CreateKeyPack         'CKP
  2387. Func AS INTEGER            '20
  2388. Stat AS INTEGER            'ret:completion status
  2389. FilenamePtrOff AS INTEGER  'far pointer to filenameZ
  2390. FilenamePtrSeg AS INTEGER  '(filename must end with a CHR$(0))
  2391. KeyExpPtrOff AS INTEGER    'far pointer to key expressionZ
  2392. KeyExpPtrSeg AS INTEGER    '(key expression must end with a CHR$(0))
  2393. XBlink AS INTEGER          'BULLET XB data file handle this key file indexes
  2394. KeyFlags AS INTEGER        'bit 0=unique,1=char,4=int,5=long,(E=NLS),F=signed
  2395. CodePageID AS INTEGER      'code page ID for NLS, -1 to use system default
  2396. CountryCode AS INTEGER     'country code number for NLS, -1 to use default
  2397. CollatePtrOff AS INTEGER   'far pointer to programmer-supplied collate table
  2398. CollatePtrSeg AS INTEGER   'or 0:0 if using system-determined NLS table
  2399. END TYPE '24
  2400. Bit 14 in KeyFlags (0Eh) is set by BULLET during CreateKXB if a collate table
  2401. is present.
  2402. See: DescriptorPack  is_NLS
  2403. ~DescriptorPack
  2404.  Src: GetDescriptorXBsrc  Func: GetDescriptorXB
  2405. TYPE DescriptorPack        'DP
  2406. Func AS INTEGER            '30
  2407. Stat AS INTEGER            'ret:completion status
  2408. Handle AS INTEGER          'BULLET data file handle to get information on
  2409. FieldNumber AS INTEGER     'field number to get info on, or if 0 then...
  2410. FD AS FieldDescTYPE        '...search for DP.FD.FieldName
  2411. END TYPE '40
  2412. GetDescriptorXB allows you to get the field descriptor info for a particular
  2413. field number (as in the first field, or the 10th field, etc.) or, if you don't
  2414. know the physical field number, the routine can also get the info for a field
  2415. by field name.
  2416. To get the info for field number, say 5, set DP.FieldNumber = 5. The DP.FD
  2417. structure element is filled in with field 5's information.
  2418. To get the info for a field by fieldname, say LASTNAME, set DP.FieldNumber=0 &
  2419. DP.FD.FieldName = "LASTNAME" + STRING$(11,0)--the fieldname must be zero-filled
  2420. and zero-terminated--adding 11 ASCII zeroes ensures this requirement.
  2421. See: DOSFilePack  FieldDescTYPE
  2422. ~DOSFilePack
  2423.  Src: AccessFileDOSsrc  Func: AccessFileDOS
  2424.                               (all routines ending with DOS)
  2425. TYPE DOSFilePack           'DFP
  2426. Func AS INTEGER            'varies, see DeleteFileDOS for first of DOS routines
  2427. Stat AS INTEGER            'ret:completion status
  2428. FilenamePtrOff AS INTEGER  'far pointer to filenameZ
  2429. FilenamePtrSeg AS INTEGER  '(filename must end with a CHR$(0))
  2430. Handle AS INTEGER          'in: handle to access  ret: handle opened
  2431. ASmode AS INTEGER          'open access/sharing mode
  2432. Bytes AS INTEGER           'in: bytes to read  ret: bytes read
  2433. SeekOffset AS LONG         'seek to file position
  2434. Method AS INTEGER          'seek method
  2435. BufferPtrOff AS INTEGER    'far pointer to read/write buffer
  2436. BufferPtrSeg AS INTEGER
  2437. Attr AS INTEGER            'file create directory entry attribute
  2438. NewNamePtrOff AS INTEGER   'far pointer to new filenameZ for rename
  2439. NewNamePtrSeg AS INTEGER   '(filename must end with a CHR$(0))
  2440. END TYPE '30
  2441. All of the xDOS routines use this pack. Often only a few of the structure
  2442. elements are used by any one of the routines. Set only those needed.
  2443. See: DVmonPack
  2444. ~DVmonPack
  2445.  Src: DVmonCXBsrc      Func: DVmonCXB
  2446. TYPE DVmonPackTYPE         'THIS ROUTINE IS AVAILABLE ONLY IN THE DEBUG ENGINE
  2447. Func AS INTEGER            '9
  2448. Stat AS INTEGER            'ret:completion status
  2449. Mode AS INTEGER            '=0 disable montitoring, =1 enable
  2450. Handle AS INTEGER          'file handle to monitor
  2451. VideoSeg AS INTEGER        'segment to write screen image (e.g., &HB800)
  2452. END TYPE '10 bytes
  2453. This routine is supplied only in the BULLET debug engine. It displays real-time
  2454. monitoring information of a .DBF file or index and .DBF file pair including
  2455. searches, seeks, hits, current record number, current key, key node contents,
  2456. key node pointers, stack state, key and record counts, and other info.
  2457. By using the HereSeg value returned from StatKXB you can locate the searches,
  2458. seeks, and hits data at (DEF SEG=HereSeg: Seeks&=GetLongAt&(517): DEF SEG)
  2459.  +513 Searches AS LONG ;keys searched for since open
  2460.  +517 Seeks AS LONG    ;nodes seeked since open
  2461.  +521 Hits AS LONG     ;seeks satisfied without disk access
  2462. See: ExitPack
  2463. ~ExitPack
  2464.  Src: InitXBsrc        Func: ExitXB, AtExitXB
  2465. TYPE ExitPack              'EP
  2466. Func AS INTEGER            '1=ExitXB, 2=AtExitXB
  2467. Stat AS INTEGER            'ret:completion status
  2468. END TYPE '4 bytes
  2469. See: FieldDescTYPE
  2470. ~FieldDescTYPE
  2471.  Src: CreateDXBsrc     Func: CreateDXB
  2472. TYPE FieldDescTYPE         'this TYPE is used by CreateDataPack ONLY
  2473. FieldName AS STRING * 11   'zero-filled field name (use only ASCII 65-90,95)
  2474. FieldType AS STRING * 1    'C-har,N-umeric,D-ate,L-ogical,M-emo
  2475. FieldDA AS LONG            '=0,reserved
  2476. FieldLength AS STRING * 1  'C=1-254,N=1-19(varies),D=8,L=1,M=10
  2477. FieldDC AS STRING * 1      'decimal places for FieldType=N (0,2-15)
  2478. A1 AS INTEGER              '=0,reserved
  2479. A2 AS INTEGER              '=0,reserved
  2480. filler AS STRING * 10      '=0,reserved
  2481. END TYPE '32
  2482. If you can can forgo dBASE compatility you can use the B field type. This type
  2483. is for fields that contain binary data (all dBASE fields contain ASCII text or
  2484. numeric strings). If you specify a FieldType = "B" for, say an integer field,
  2485. use a FieldLen = 2. If the field is a long integer, use FieldLen = 4. You can
  2486. also use this non-standard field type for indexing. See CreateKXB for more.
  2487. See: HandlePack  CreateDataPack  CreateKXB
  2488. ~HandlePack
  2489.  Src: CloseDXBsrc      Func: CloseDXB, ReadDHXB, FlushDHXB, ZapDHXB
  2490.                              CloseKXB, ReadKHXB, FlushKHXB, ZapKHXB
  2491.                            'HP
  2492. TYPE HandlePack            '12=CloseDXB,14=ReadDHXB,15=FlushDHXB,17=ZapDHXB
  2493. Func AS INTEGER            '22=CloseKXB,24=ReadKHXB,25=FlushKHXB,27=ZapKHXB
  2494. Stat AS INTEGER            'ret:completion status
  2495. Handle AS INTEGER          'handle of BULLET file
  2496. END TYPE '6
  2497. See: InitPack
  2498. ~InitPack
  2499.  Src: InitXBsrc        Func: InitXB
  2500. TYPE InitPack              'IP
  2501. Func AS INTEGER            '0
  2502. Stat AS INTEGER            'ret:completion status
  2503. JFTmode AS INTEGER         'expand JFT if non-zero
  2504. DOSver AS INTEGER          'ret:DOS version
  2505. Version AS INTEGER         'ret:BULLET version * 100
  2506. ExitOff AS INTEGER         'ret:far pointer to ExitXB routine, offset
  2507. ExitSeg AS INTEGER         'ret:segment of ExitXB
  2508. END TYPE '12 bytes
  2509.      
  2510. See: MemoryPack
  2511. ~MemoryPack
  2512.  Src: MemoryXBsrc      Func: MemoryXB
  2513. TYPE MemoryPack            'MP
  2514. Func AS INTEGER            '3
  2515. Stat AS INTEGER            'ret:completion status
  2516. Memory AS LONG             'ret:largest free OS memory block
  2517. END TYPE '8 bytes
  2518. See: OpenPack
  2519. ~OpenPack
  2520.  Src: OpenDXBsrc       Func: OpenDXB, OpenKXB
  2521. TYPE OpenPack              'OP
  2522. Func AS INTEGER            '11=OpenDXB,21=OpenKXB
  2523. Stat AS INTEGER            'ret:completion status
  2524. Handle AS INTEGER          'ret:OS handle of file opened
  2525. FilenamePtrOff AS INTEGER  'far pointer to filenameZ to open
  2526. FilenamePtrSeg AS INTEGER  '(filename must end with a CHR$(0))
  2527. ASmode AS INTEGER          'DOS access-sharing mode (see OpenFileDOS)
  2528. xbHandle AS INTEGER        'if opening key file this is its related data file
  2529. END TYPE '14               '(if opening data file xbHandle is not used)
  2530.                            'Note: you must supply xbHandle on index file opens
  2531. See: RemotePack  OpenFileDOS
  2532. ~RemotePack
  2533.  Src: DriveRemoteXBsrc  Func: DriveRemoteXB, FileRemoteXB
  2534. TYPE RemotePack            'RP
  2535. Func AS INTEGER            '86=DriveRemoteXB,87=FileRemoteXB
  2536. Stat AS INTEGER            'ret:completion status
  2537. Handle AS INTEGER          'handle/drive depending on routine
  2538. IsRemote AS INTEGER        'ret:0=local,1=remote
  2539. Flags AS INTEGER           'ret:dx register as returned by DOS
  2540. IsShare AS INTEGER         'ret:0=SHARE.EXE not loaded
  2541. END TYPE '12
  2542. See: SetRetriesPack
  2543. ~SetRetriesPack
  2544.  Src: SetRetriesXBsrc  Func: SetRetriesXB
  2545. TYPE SetRetriesPack        'SRP
  2546. Func AS INTEGER            '88
  2547. Stat AS INTEGER            'ret:completion status
  2548. Mode AS INTEGER            '0=set DOS default else use Pauses/Retries below
  2549. Pause AS INTEGER           '0-65535 loop counter between retries
  2550. Retries As INTEGER         '0-65535 retries to access locked file
  2551. END TYPE '10
  2552. The default values for Retries is 3 and Pause is 1.
  2553. The Pause value is used as a simple loop counter used to waste time. This loop
  2554. IS dependent on CPU power so values are not portable across different machines.
  2555. Do not use unrealistic values. For example, don't set Retries to 30,000 unless
  2556. you really want to wait for DOS to try 30,000 times before returning an error!
  2557. See: StatDataPack
  2558. ~StatDataPack
  2559.  Src: StatDXBsrc       Func: StatDXB
  2560. TYPE StatDataPackTYPE      'SDP
  2561. Func AS INTEGER            '13
  2562. Stat AS INTEGER            'ret:completion status
  2563. Handle AS INTEGER          'BULLET data file to get status on
  2564. FileType AS STRING * 1     'ret:1=BULLET XB data file
  2565. Dirty AS STRING * 1        'ret:0=not changed
  2566. Recs AS LONG               'ret:records in file
  2567. RecLen AS INTEGER          'ret:record length
  2568. Fields AS INTEGER          'ret:fields per record ()
  2569. f1 AS STRING * 1           'reserved (1=update DVmon)
  2570. LUyear AS STRING * 1       'ret:binary, year file last updated
  2571. LUmonth AS STRING * 1      'ret:month   --LUs are 0 if DBF newly created
  2572. LUday AS STRING * 1        'ret:day
  2573. HereSeg AS INTEGER         'ret:this file's control segment
  2574. filler AS STRING * 10      'reserved
  2575. END TYPE '32
  2576. See: StatKeyPack
  2577. ~StatKeyPack
  2578.  Src: StatKXBsrc       Func: StatKXB
  2579. TYPE StatKeyPack           'SKP
  2580. Func AS INTEGER            '23
  2581. Stat AS INTEGER            'ret:completion status
  2582. Handle AS INTEGER          'BULLET key file to get status on
  2583. FileType AS STRING * 1     'ret:0=BULLET XB key file
  2584. Dirty AS STRING * 1        'ret:0=not changed
  2585. Keys AS LONG               'ret:keys in file
  2586. KeyLen AS INTEGER          'ret:key length
  2587. XBlink AS INTEGER          'ret:related BULLET XB data file handle
  2588. XBrecno AS LONG            'ret:record number attached to current key
  2589. HereSeg AS INTEGER         'ret:this file's control segment
  2590. CodePageID AS INTEGER      'ret:code page ID number of key file sort
  2591. CountryCode AS INTEGER     'ret:country code number of key file sort
  2592. CollateTableSize AS INTEGER 'ret: size of collate table, 0 or 256
  2593. KeyFlags AS INTEGER        'ret:bit 0=unique,1=char,4=int,5=long,E=NLS,F=signed
  2594. filler AS STRING * 2
  2595. END TYPE '32
  2596. See: StatHandlePack
  2597. ~StatHandlePack
  2598.  Src: StatHandleXBsrc  Func: StatHandleXB
  2599. TYPE StatHandlePack        'SHP
  2600. Func AS INTEGER            '6
  2601. Stat AS INTEGER            'ret:completion status
  2602. Handle AS INTEGER          'file handle to get information on
  2603. ID AS INTEGER              'ret:0=XB index,1=XB data file,-1=not BULLET handle
  2604. END TYPE '8 bytes
  2605. See: XErrorPack
  2606. ~XErrorPack
  2607.  Src: GetExtErrorXBsrc Func: GetExtErrorXB
  2608. TYPE XErrorPack            'XEP
  2609. Func AS INTEGER            '7
  2610. Stat AS INTEGER            'ret:extended error
  2611. Class AS INTEGER           'ret:error class
  2612. Action AS INTEGER          'ret:suggested action
  2613. Location AS INTEGER        'ret:error location
  2614. END TYPE '10 bytes
  2615. See: AccessPack  Errors_DOS
  2616. ~Errors_BULLET    (200-209)
  2617. 200 key not found - The search key for Equal was not matched exactly.
  2618.     Next/Prev routines can be used to continue search from point of mismatch.
  2619. 201 key already exists - Attempted to add a key that already exists in the
  2620.     index file created to allow only unique keys.
  2621. 202 end of file - A Next routine is past the last key of the index file.
  2622. 203 top of file - A Prev routine is before the first key of the index file.
  2623. 204 key file empty - A key access was attempted with no keys in the index file.
  2624. 205 key type unknown - Generally indicates a corrupt index header (keyflags
  2625.     unknown at key insert).
  2626.     reserved,206-207
  2627. 208 no more nodes - The index file has reached full capacity (32MB). ReindexXB
  2628.     can often shrink an index file by 30 to 50%.
  2629. 209 key file corrupt - The index file is corrupt (write attempt to node 0).
  2630. See: Errors_BULLET_b
  2631. ~Errors_BULLET_b  (210-232)
  2632. 210 key file corrupt - The index file is corrupt (internal overflow).
  2633.     reserved,211-219
  2634. 220 incorrect DOS version - BULLET requires DOS 3.3 or later.
  2635. 221 invalid key length - The key is > 62 bytes (or 64 if unique specified).
  2636. 222 file not open - The specified handle is not an open BULLET file.
  2637.        
  2638.     reserved,223
  2639. 224 invalid record number - The specified record number is < 0, past the last
  2640.     record number in the .DBF, or is > 16,777,215.
  2641.     reserved,225-227
  2642. 228 invalid filetype - The specified handle is not the correct type for the
  2643.     operation (i.e., specifying a data file handle for a key file operation).
  2644.     reserved,229-232
  2645. See: Errors_BULLET_c
  2646. ~Errors_BULLET_c  (233-243)
  2647. 233 init not active - InitXB must be called before all others except MemoryXB.
  2648. 234 init already active - InitXB has already been called. Use ExitXB first to
  2649.     call InitXB more than once per process. (Make sure the xxP.Func <> 0.)
  2650. 235 too many indexes - BULLET can handle up to 32 index files per transaction
  2651.     record with the InsertXB and UpdateXB routines. Contact the author if you
  2652.     need to allow for more than 32 index files/transaction record.
  2653.     reserved,236-239
  2654. 240 invalid key expression - The CreateKXB key expression could not be
  2655.     evaluated.
  2656.     reserved,241
  2657. 242 field not found - The fieldname was not found in the descriptor area.
  2658. 243 invalid field count - Too many fields were specified or the specified field
  2659.     number is past the last field.
  2660. See: Errors_BULLET_d
  2661. ~Errors_BULLET_d  (244-255)
  2662.     reserved,244-249
  2663. 250 invalid country info - The specifed country code or code page ID is not
  2664.     valid or not installed (according to DOS).
  2665. 251 invalid collate table size - The specified country code/code page ID uses
  2666.     a collate-sequence table > 256 bytes (2-byte characters as with Kanji).
  2667. 252 invalid keyflags - The specified keyflags are invalid.
  2668.     reserved,253-254
  2669. 255 evaluation mode shutdown - BULLET evaluation period has completed.
  2670.     You can reinstall to continue evaluation, though you may want to consider
  2671.     your motives for reinstalling since the original evaluation period has
  2672.     expired. This error occurs only after the evaluation period has expired.
  2673.     It is not recommended that you continue to use BULLET after the evaluation
  2674.     period. It is possible for no 255 error to be generated for quite some
  2675.     time since it occurs only under certain load conditions and then only when
  2676.     certain routine sequences are performed. The specified evaluation period of
  2677.     21 days should be adhered to.
  2678. See: Errors_BASIC
  2679. ~Errors_BASIC
  2680.  1 NEXT without FOR                    24 device timeout
  2681.  2 syntax error                        25 device fault
  2682.  3 RETURN without GOSUB                26 FOR without NEXT
  2683.  4 out of DATA                         27 out of paper
  2684.  5 illegal function call               29 WHILE without WEND
  2685.  6 overflow                            30 WEND without WHILE
  2686.  7 out of memory                          reserved,31-32
  2687.  8 label not defined                   33 duplicate label
  2688.  9 subscript out of range                 reserved,34
  2689. 10 duplicate definition                35 subprogram not defined
  2690. 11 division by zero                       reserved,36
  2691. 12 illegal in direct mode              37 argument-count mismatch
  2692. 13 type mismatch                       38 array not defined
  2693. 14 out of string space                    reserved,39
  2694.    reserved,15                         40 variable required
  2695. 16 string formula too complex             reserved,41-49
  2696. 17 cannot continue                     50 FIELD overflow
  2697. 18 function not defined                51 internal error
  2698. 19 no RESUME                           52 bad file name or number
  2699. 20 RESUME without error                53 file not found
  2700.    reserved,21-23                      54 bad file mode
  2701. See: Errors_BASIC_b
  2702. ~Errors_BASIC_b
  2703. 55 file already open                      reserved,77-79
  2704. 56 FIELD statement active              80 feature removed
  2705. 57 device I/O error                    81 invalid name
  2706. 58 file already exists                 82 table not found
  2707. 59 bad record length                   83 index not found
  2708.    reserved,60                         84 invalid column
  2709. 61 disk full                           85 no current record
  2710. 62 input past end of file              86 duplicate value for unique index
  2711. 63 bad record number                   87 invalid operation on null index
  2712. 64 bad file name                       88 database needs repair
  2713.    reserved,65-66                      89 insufficient ISAM buffers
  2714. 67 too many files
  2715. 68 device unavailable
  2716. 69 communication-buffer overflow
  2717. 70 permission denied
  2718. 71 disk not ready
  2719. 72 disk-media error
  2720. 73 feature unavailable
  2721. 74 rename across disks
  2722. 75 path/File access error
  2723. 76 path not found
  2724. See: Errors_DOS
  2725. ~Errors_DOS
  2726. -2 disk full or unexpected end of file
  2727. -1 bad filename
  2728.  0 no error
  2729.  1 function not supported              19 disk write protected
  2730.  2 file not found                      20 unknown unit
  2731.  3 path not found                      21 drive not ready
  2732.  4 too many open files                 22 unknown command
  2733.  5 access denied (see Specs_Networks)  23 data error (CRC)
  2734.  6 handle invalid                      24 bad request structure length
  2735.  7 MCBs destroyed                      25 seek error
  2736.  8 not enough memory                   26 unknown medium type
  2737.  9 memory block address invalid        27 sector not found
  2738. 10 environment invalid                 28 printer out of paper
  2739. 11 format invalid                      29 write fault
  2740. 12 access code invalid                 30 read fault
  2741. 13 data invalid                        31 general failure
  2742.    reserved-0Eh                        32 sharing violation
  2743. 15 disk drive invalid                  33 lock violation
  2744. 16 cannot remove current directory     34 disk change invalid/wrong disk
  2745. 17 not same device                     35 FCB unavailable
  2746. 18 no more files                       36 sharing buffer overflow
  2747. See: Errors_DOS_b
  2748. ~Errors_DOS_b
  2749. 37 code page mismatched                58 incorrect response from network
  2750. 38 handle EOF                          59 unexpected network error
  2751. 39 handle disk full                    60 incompatible remote adapter
  2752.    reserved-28h                        61 print queue full
  2753.    reserved-29h                        62 no spool space
  2754.    reserved-2Ah                        63 not enough space to print file
  2755.    reserved-2Bh                        64 network name deleted
  2756.    reserved-2Ch                        65 network access denied
  2757.    reserved-2Dh                        66 network device type incorrect
  2758.    reserved-2Eh                        67 network name not found
  2759.    reserved-2Fh                        68 network name limit exceeded
  2760.    reserved-30h                        69 NETBIOS session limit exceeded
  2761.    reserved-31h                        70 sharing temporarily paused
  2762. 50 network request not supported       71 network request not accepted
  2763. 51 remote computer not listening       72 print/disk redirection paused
  2764. 52 duplicate name on network              reserved-49h
  2765. 53 network pathname not found             reserved-4Ah
  2766. 54 network busy                           reserved-4Bh
  2767. 55 network device no longer exists        reserved-4Ch
  2768. 56 NETBIOS command limit exceeded         reserved-4Dh
  2769. 57 network adapter hardware error         reserved-4Eh
  2770. See: Errors_DOS_c
  2771. ~Errors_DOS_c
  2772.    reserved-4Fh                  
  2773.  DOS Class Codes 
  2774. 80 file exists
  2775. 81 duplicate FCB                 1 out of resources       7 application error
  2776. 82 cannot make                   2 temporary situation    8 not found
  2777. 83 fail on INT24                 3 authorization          9 bad format
  2778. 84 out of structures             4 internal error        10 locked
  2779. 85 already assigned              5 hardware failure      11 media failure
  2780. 86 invalid password              6 system failure        12 already exists
  2781. 87 invalid parameter                                     13 unknown
  2782. 88 network write fault
  2783.    reserved-59h                    DOS Action Codes         DOS Locus Codes
  2784. 90 sys comp not loaded
  2785.                                  1 retry immediately      1 unknown
  2786.                                  2 delay and retry        2 block device
  2787.                                  3 reenter input          3 network
  2788.                                  4 abort ASAP             4 serial device
  2789.                                  5 abort immediately      5 memory
  2790.                                  6 ignore error
  2791.                                  7 user intervention
  2792. See: Errors_BULLET
  2793. ~InitXBsrc
  2794. Func: InitXB           Pack: InitPack           Func:   0/System
  2795. DIM IP AS InitPack
  2796. DIM EP AS ExitPack
  2797. IP.Func = InitXB        'InitXB defined in BULLET.BI
  2798. IP.JFTmode = 1          'expand JFT to 255 handles
  2799. stat = BULLET(IP)
  2800. IF stat = 0 THEN
  2801.    DOSmajor = IP.DOSver\256
  2802.    DOSminor = IP.DOSver MOD 256
  2803.    BULLETver = IP.Version
  2804.    SegExitXB = IP.ExitSeg
  2805.    OffExitXB = IP.ExitOff
  2806.    EP.Func = AtExitXB   'register ExitXB with _atexit shutdown routine
  2807.    stat = BULLET(EP)
  2808. ENDIF
  2809. IF stat THEN 'error
  2810. See: ExitXBsrc
  2811. ~ExitXBsrc
  2812. Func: ExitXB           Pack: ExitPack           Func:   1/System
  2813. DIM EP AS ExitPack
  2814. EP.Func = ExitXB        'ExitXB defined in BULLET.BI
  2815. stat = BULLET(EP)
  2816. The return value from ExitXB is currently always 0.
  2817. See: AtExitXBsrc
  2818. ~AtExitXBsrc
  2819. Func: AtExitXB         Pack: ExitPack           Func:   2/System
  2820. DIM IP AS InitPack
  2821. DIM EP AS ExitPack
  2822. IP.Func = InitXB
  2823. IP.JFTmode = 1
  2824. stat = BULLET(IP)
  2825. IF stat = 0 THEN
  2826.    DOSmajor = IP.DOSver\256
  2827.    DOSminor = IP.DOSver MOD 256
  2828.    SegExitXB = IP.ExitSeg
  2829.    OffExitXB = IP.ExitOff
  2830.                         'register ExitXB with _atexit shutdown routine
  2831.    EP.Func = AtExitXB   'AtExitXB defined in BULLET.BI
  2832.    stat = BULLET(EP)    'the return value is that returned from the compiler
  2833.                         '_atexit routine, 0=okay, anything else is an error
  2834. ENDIF                   'indicating, for example, the _atexit register is full
  2835. IF stat THEN 'error
  2836. See: MemoryXBsrc
  2837. ~MemoryXBsrc
  2838. Func: MemoryXB         Pack: MemoryPack         Func:   3/System
  2839. DIM MP AS MemoryPack
  2840. WorkSpace& = 50000      'a value at least 40K or so
  2841. MemoryNeeded& = WorkSpace& + (144&+ ((1+NF)*32)) * TotalOpenDataFiles _
  2842.                            + (1264& * TotalOpenKeyFiles)
  2843. MP.Func = MemoryXB
  2844. stat = BULLET(MP)
  2845. IF MP.Memory < MemoryNeeded& THEN
  2846.     QBheap& = SETMEM(-MemoryNeeded& + 4096)  'release what we need+QB fudge
  2847.     MP.Func = MemoryXB
  2848.     stat = BULLET(MP)
  2849.     IF MP.Memory < MemoryNeeded& THEN 'not enough memory
  2850. END IF
  2851. MP.Memory does not reflect memory available through DOS in the UMB area. It's
  2852. possible that all memory requests can be satisfied by UMB RAM. Consult a DOS 5+
  2853. programmer reference for more information on this (see DOS INT21/58 for more).
  2854. In the QuickBASIC/BASIC PDS environment do not call SETMEM(-x) more than once.
  2855. See: BreakXBsrc
  2856. ~BreakXBsrc
  2857. Func: BreakXB          Pack: BreakPack          Func:   4/System
  2858. DIM BP AS BreakPack
  2859. BP.Func = BreakXB       'BreakXB defined in BULLET.BI
  2860. BP.Mode = 0             'disable Ctrl-C/Ctrl-BREAK (do nothing on those keys)
  2861. stat = BULLET(BP)       'stat=0 always
  2862. If BreakXB is called multiple times with the same BP.mode each time, only the
  2863. first is acted on. You can set BP.mode = 1 to restore the default handlers
  2864. (those installed originally) and then again set BP.Mode = 0 to disable them.
  2865. ExitXB calls this routine automatically as part of the BULLET shutdown to
  2866. restore the original default break handlers.
  2867. See: BackupFileXBsrc
  2868. ~BackupFileXBsrc
  2869. Func: BackupFileXB     Pack: CopyPack           Func:   5/System
  2870. DIM AP AS AccessPack
  2871. DIM CP AS CopyPack
  2872. DIM TempStr AS STRING * 80      'used as fixed-length string for VARPTR()
  2873.                                 'so same source QB AND BASIC7 /Fs compatible
  2874. TempStr = NewFilename$          'assign the var-len string to fixed-len str
  2875. CP.Func = BackupFileXB  'defined in BULLET.BI
  2876. CP.Handle = DataHandle  'handle of data file to backup
  2877. CP.FilenamePtrOff = VARPTR(TempStr) 'ALWAYS use VARPTR() on fixed-len string
  2878. CP.FilenamePtrSeg = VARSEG(TempStr) 'ALWAYS use VARSEG() on fixed-len string
  2879. stat = BULLET(CP)       'copy the data file to the file NewFilename$
  2880. IF stat = 0 THEN
  2881.    AP.Func = PackRecordsXB
  2882.    AP.Handle = DataHandle
  2883.    stat = BULLET(AP)
  2884. ENDIF
  2885. IF stat THEN 'error
  2886. See: StatHandleXBsrc
  2887. ~StatHandleXBsrc
  2888. Func: StatHandleXB     Pack: StatHandlePack     Func:   6/System
  2889. DIM SHP AS StatHandlePack
  2890. DIM SKP AS StatKeyPack
  2891. DIM SDP AS StatDataPack
  2892. SHP.Func = StatHandleXB 'defined in BULLET.BI
  2893. SHP.Handle = TheHandleNumber
  2894. stat = BULLET(SHP)
  2895. IF SHP.ID = 0 THEN      'handle belongs to an index file (index file/key file)
  2896.    SKP.Func = StatKXB   'get key stats  -- see StatKXB/StatDXB for more
  2897.    SKP.Handle = PassedHandleNumber      ' on the SKP structure
  2898.    stat = BULLET(SKP)
  2899. ELSEIF SHP.ID = 1 THEN  '.DBF data file
  2900.    'get DBF stats
  2901.    'error not a BULLET file type
  2902. ENDIF
  2903. See: GetExtErrorXBsrc
  2904. ~GetExtErrorXBsrc
  2905. Func: GetExtErrorXB    Pack: XErrorPack         Func:   7/System
  2906. 'an error just occured in the range 1 to 199 as returned in one of the
  2907. 'pack.Stat variables (current max DOS error is 90 (5Ah))
  2908. 'remember, transaction-based routines return a bad pack index in the return
  2909. 'stat value, which you use to check the appropriate pack.Stat variable
  2910. DIM XEP AS XErrorPack
  2911. XEP.Func = GetExtErrorXB 'defined in BULLET.BI
  2912. stat = BULLET(XEP)
  2913. IF stat <> 0 THEN
  2914.    PRINT "Extended Codes --"
  2915.    PRINT "            error: "; XEP.Stat
  2916.    PRINT "      error class: "; XEP.Class
  2917.    PRINT "recommened action: "; XEP.Action
  2918.    PRINT "         location: "; XEP.Location
  2919.    PRINT "No error"
  2920. ENDIF
  2921. See: DVmonCXBsrc  StatKXB
  2922. ~DVmonCXBsrc
  2923. Func: DVmonCXB         Pack: DVmonPack          Func:   9/DEBUG
  2924. 'at this point a data file and a key file have been opened
  2925. 'kf is that key file's DOS handle
  2926. DIM DV AS DVmonPack
  2927. DV.Func = DVmonCXB      'defined in BULLET.BI
  2928. DV.Mode = 1             'enable monitoring
  2929. DV.Handle = kf          'monitor key file handle, kf (and its XBlink data file)
  2930. DV.VideoSeg = &HB800+(4096\16)  'output to color screen, page 1 (pages 0 to ?)
  2931. stat = BULLET(DV)       'stat=0 always even if not DEBUG ENGINE
  2932. For two-monitor systems (with a color monitor as the main system) output should
  2933. be directed to &HB000, the mono monitor's video memory.
  2934. DVmonCXB stands for Dual Video Monitor Control XB.
  2935. See: CreateDXBsrc
  2936. ~CreateDXBsrc
  2937. Func: CreateDXB        Pack: CreateDataPack     Func:  10/Mid-level
  2938. DIM CDP AS CreateDataPack
  2939. DIM TempStr AS STRING * 80      'used as fixed-length string for VARPTR()
  2940. REDIM FD(1 TO 2) AS FieldDescTYPE 'field descriptions for each of the fields...
  2941.                                   '...in the record (record has 2 fields)
  2942. TempStr = filename$ + CHR$(0)   'assign filename to a fixed-len string...
  2943.                                 '...so we can use VARSEG/VARPTR
  2944. 'build FD first for each of the fields in the record
  2945. FD(1).FieldName = "STUDENT" + STRING$(10,0)   'must be zero-filled
  2946. FD(1).FieldType = "C"           'a character field type
  2947. FD(1).FieldLength = CHR$(20)    'up to 20 characters (a byte field--use CHR$())
  2948. FD(1).FieldDC = CHR$(0)         'non-numeric has no decimal places
  2949. FD(2).FieldName = "SCORE" + STRING$(10,0)
  2950. FD(2).FieldType = "N"
  2951. FD(2).FieldLength = CHR$(3)     'dBASE numeric format, allow for "100"
  2952. FD(2).FieldDC = CHR(0)          'no decimal places used for this field
  2953. '(cont)
  2954.                      'for BINARY FieldType="B" see FieldDescTYPE
  2955. See: CreateDXBsrc_a                                                     -MORE-
  2956. ~CreateDXBsrc_a
  2957. 'build the CDP
  2958. CDP.Func = CreateDXB            'defined in BULLET.BI
  2959. CDP.FilenamePtrOff = VARPTR(TempStr) 'point to filenameZ (Z=0-terminated str)
  2960. CDP.FilenamePtrSeg = VARSEG(TempStr)
  2961. CDP.NoFields = 2                'this example has 2 fields
  2962. CDP.FieldListPtrOff = VARPTR(FD(1)) 'point to the first field decription...
  2963. CDP.FieldListPtrSeg = VARPTR(FD(1)) '...defined in the previous screen
  2964. CDP.FileID = 3                  'standard dBASE file ID
  2965. stat = BULLET(CDP)              'create the DBF data file
  2966. IF stat THEN 'error
  2967. Normally this code would be written as a generalized FUNCTION. The CDP could be
  2968. a global allocation (DIM SHARED CDP AS CreateDataPack) and the FD() would also
  2969. be (REDIM [SHARED] FD(1 TO 1) AS FieldDescTYPE) and REDIM'd to needed size when
  2970. used. A possible header:
  2971.  DECLARE FUNCTION CreateDBF% (filename$, NoFields%, FD() AS FieldDescTYPE)
  2972. To create a DBF you'd need just the filename, number of fields, REDIM the FD()
  2973. array (if needed), fill in FD() array, then call the function. Look at the
  2974. source code examples on the distribution disk for more.
  2975. See: OpenDXBsrc  CreateDXBsrc
  2976. ~OpenDXBsrc
  2977. Func: OpenDXB          Pack: OpenPack           Func:  11/Mid-level
  2978. DIM OP AS OpenPack
  2979. DIM TempStr AS STRING * 80      'used as fixed-length string for VARPTR()
  2980. TempStr = filename$ + CHR$(0)   'assign filename to a fixed-len string...
  2981. OP.Func = OpenDXB                   'defined in BULLET.BI
  2982. OP.FilenamePtrOff = VARPTR(TempStr) 'point to filenameZ (Z=0-terminated str)
  2983. OP.FilenamePtrSeg = VARSEG(TempStr)
  2984. OP.ASmode = ReadWrite + DenyNone    'defined in BULLET.BI
  2985. stat = BULLET(OP)
  2986. IF stat THEN 'error
  2987. The ASmode (access/sharing mode) determines how the operating system controls
  2988. access to the file. See OpenFileDOS for the meanings of the various ASmodes.
  2989. See: CloseDXBsrc  OpenFileDOS
  2990. ~CloseDXBsrc
  2991. Func: CloseDXB         Pack: HandlePack         Func:  12/Mid-level
  2992. DIM HP AS HandlePack
  2993. HP.Func = CloseDXB              'defined in BULLET.BI
  2994. HP.Handle = datahandle          'handle of the file to close
  2995. stat = BULLET(HP)
  2996. IF stat THEN 'error
  2997. See: StatDXBsrc
  2998. ~StatDXBsrc
  2999. Func: StatDXB          Pack: StatDataPack       Func:  13/Mid-level
  3000. DIM SDP AS StatDataPack
  3001. SDP.Func = StatDXB          'defined in BULLET.BI
  3002. SDP.Handle = datahandle     'data handle to get stats on
  3003. stat = BULLET(SDP)          'must be a data handle, use StatHandleXB if you...
  3004. IF stat = 0 THEN            '...don't know the type of file a handle's for
  3005.    'SDP.FileType is set to 1
  3006.    'SDP.Dirty is set to 1 if the file has changed (0=not changed)
  3007.    'SDP.Recs = number of records in the DBF file
  3008.    'SDP.RecLen = record length
  3009.    'SDP.Fields = number of fields in the record
  3010.    'SDP.f1 is reserved
  3011.    'SDP.LUyear = year file last updated, binary (year = ASC(SDP.LUyear))
  3012.    'SDP.LUmonth = month, binary
  3013.    'SDP.LUday = day, binary
  3014.    'SDP.HereSeg is set to this handle's control segment (location in memory)
  3015.    'error
  3016. ENDIF
  3017. See: ReadDHXBsrc
  3018. ~ReadDHXBsrc
  3019. Func: ReadDHXB         Pack: HandlePack         Func:  14/Mid-level
  3020. DIM HP AS HandlePack
  3021. HP.Func = ReadDHXB              'defined in BULLET.BI
  3022. HP.Handle = datahandle          'handle of file whose header you want to reload
  3023. stat = BULLET(HP)
  3024. IF stat THEN 'error
  3025. This routine is automatically called by the network lock routines.
  3026. See: FlushDHXBsrc  LockDataXB
  3027. ~FlushDHXBsrc
  3028. Func: FlushDHXB        Pack: HandlePack         Func:  15/Mid-level
  3029. DIM HP AS HandlePack
  3030. HP.Func = FlushDHXB             'defined in BULLET.BI
  3031. HP.Handle = datahandle          'handle of file you want to flush
  3032. stat = BULLET(HP)
  3033. IF stat THEN 'error
  3034. Note that the physical write to disk is performed only if the file has changed
  3035. since the open or last flush.
  3036. This routine is automatically called by the network unlock routines.
  3037. See: CopyDHXBsrc  UnlockDataXB
  3038. ~CopyDHXBsrc
  3039. Func: CopyDHXBsrc      Pack: CopyPack           Func:  16/Mid-level
  3040. DIM CP AS CopyPack
  3041. DIM TempStr AS STRING * 80      'used as fixed-length string for VARPTR()
  3042. TempStr = filename$ + CHR$(0)   'assign filename to a fixed-len string...
  3043. CP.Func = CopyDHXB              'defined in BULLET.BI
  3044. CP.Handle = datahandle          'handle of file to copy from (the source)
  3045. CP.FilenamePtrOff = VARPTR(TempStr) 'far pointer to filenameZ for copy
  3046. CP.FilenamePtrSeg = VARPTR(TempStr) '(the destination)
  3047. stat = BULLET(CP)
  3048. IF stat THEN 'error
  3049. See: ZapDHXBsrc
  3050. ~ZapDHXBsrc
  3051. Func: ZapDHXB          Pack: HandlePack         Func:  17/Mid-level
  3052. DIM HP AS HandlePack
  3053. HP.Func = ZapDHXB               'defined in BULLET.BI
  3054. HP.Handle = datahandle          'handle of file you want !ZAP!
  3055. stat = BULLET(HP)
  3056. IF stat THEN 'error
  3057. Note that this removes ALL data records from the data file.
  3058. See: CreateKXBsrc
  3059. ~CreateKXBsrc
  3060. Func: CreateKXB        Pack: CreateKeyPack      Func:  20/Mid-level
  3061. 'This code assumes that the datafile was created as in CreateDXBsrc, and that
  3062. 'the datafile was opened as in OpenDXBsrc.
  3063. kx$ = "SUBSTR(STUDENT,1,5)"     'key expression, a non-unique, character key
  3064. DIM CKP AS CreateKeyPack
  3065. DIM TempStr AS STRING * 80      'used as fixed-length string for VARPTR()
  3066. DIM TempStr2 AS STRING * 136    'used as fixed-length string for VARPTR()
  3067. TempStr = filename$ + CHR$(0)   'assign filename to a fixed-len string
  3068. TempStr2 = kx$ + CHR$(0)        'same for key expression string
  3069. '(cont)
  3070. See: CreateKXBsrc_a                                                     -MORE-
  3071. ~CreateKXBsrc_a
  3072. CKP.Func = CreateKXB                 'defined in BULLET.BI
  3073. CKP.FilenamePtrOff = VARPTR(TempStr) 'far pointer to filenameZ
  3074. CKP.FilenamePtrSeg = VARSEG(TempStr)
  3075. CKP.KeyExpPtrOff = VARPTR(TempStr2)  'far pointer to key expressionZ
  3076. CKP.KeyExpPtrSeg = VARSEG(TempStr2)
  3077. CKP.XBlink = datahandle              'the datafile handle returned from OpenDXB
  3078. CKP.KeyFlags = cCHAR                 '-KEYFLAGS- are defined in BULLET.BI
  3079. CKP.CodePageID = -1                  'use DOS default code page ID
  3080. CKP.CountryCode = -1                 'use DOS default country code
  3081. CKP.CollatePtrOff = 0                'no user-supplied collate table...
  3082. CKP.CollatePtrSeg = 0                '...
  3083. stat = BULLET(CKP)
  3084. IF stat THEN 'error
  3085. Normally this code would be written as a generalized FUNCTION. The CKP could be
  3086. a global allocation (DIM SHARED CKP AS CreateKeyPack). A possible header:
  3087.  DECLARE FUNCTION CreateNewIndex% (filename$, datahandle, kx$, KeyFlags%)
  3088. To create an index file you'd need just filename, datahandle, key expression,
  3089. and key flags (country code info if not using default), then call the function.
  3090. See: OpenKXBsrc  CreateKXBsrc
  3091. ~OpenKXBsrc
  3092. Func: OpenKXB          Pack: OpenPack           Func:  21/Mid-level
  3093. DIM OP AS OpenPack
  3094. DIM TempStr AS STRING * 80      'used as fixed-length string for VARPTR()
  3095. TempStr = filename$ + CHR$(0)   'assign filename to a fixed-len string...
  3096. OP.Func = OpenKXB                   'defined in BULLET.BI
  3097. OP.FilenamePtrOff = VARPTR(TempStr) 'point to filenameZ (Z=0-terminated str)
  3098. OP.FilenamePtrSeg = VARSEG(TempStr)
  3099. OP.ASmode = ReadWrite + DenyNone    'defined in BULLET.BI
  3100. OP.XBlink = datafilehandle          'OpenKXB needs to know the data file handle
  3101. stat = BULLET(OP)
  3102. IF stat THEN 'error
  3103. The ASmode (access/sharing mode) determines how the operating system controls
  3104. access to the file. See OpenFileDOS for the meanings of the various ASmodes.
  3105. Before you can open an index file you must first open its associated data file.
  3106. See: CloseKXBsrc  OpenFileDOS
  3107. ~CloseKXBsrc
  3108. Func: CloseKXB         Pack: HandlePack         Func:  22/Mid-level
  3109. DIM HP AS HandlePack
  3110. HP.Func = CloseDXB              'defined in BULLET.BI
  3111. HP.Handle = indexhandle         'handle of the file to close
  3112. stat = BULLET(HP)
  3113. IF stat THEN 'error
  3114. See: StatKXBsrc
  3115. ~StatKXBsrc
  3116. Func: StatKXB          Pack: StatKeyPack        Func:  23/Mid-level
  3117. DIM SKP AS StatKeyPack
  3118. SKP.Func = StatKXB          'defined in BULLET.BI
  3119. SKP.Handle = indexhandle    'handle to get stats on
  3120. stat = BULLET(SKP)          'must be index handle, use StatHandleXB if you...
  3121. IF stat = 0 THEN            '...don't know the type of file a handle's for
  3122.    'SKP.FileType is set to 0
  3123.    'SKP.Dirty is set to 1 if the file has changed (0=not changed)
  3124.    'SKP.Keys = number of key in the index file (index file=key file)
  3125.    'SKP.KeyLen = physical key length (1-64 bytes)
  3126.    'SKP.XBlink = datafile handle that this index file is associated with
  3127.    'SKP.XBrecno is set to record number associated with last accessed key
  3128.    'SKP.HereSeg is set to this handle's control segment (location in memory)
  3129.    'SKP.CodePageID returns this index file's permanent code page ID
  3130.    'SKP.CountryCode returns this index file's permanent country code
  3131.    'SKP.CollateTableSize = 0 (no collate table present) or 256 (table present)
  3132.    'SKP.KeyFlags = key flags specifed at CreateKXB (except NLS flag may be set)
  3133. ELSE                                               (NLS flag is bit 14, &H4000)
  3134.    'error
  3135. See: ReadKHXBsrc
  3136. ~ReadKHXBsrc
  3137. Func: ReadKHXB         Pack: HandlePack         Func:  24/Mid-level
  3138. DIM HP AS HandlePack
  3139. HP.Func = ReadKHXB              'defined in BULLET.BI
  3140. HP.Handle = indexhandle         'handle of file whose header you want to reload
  3141. stat = BULLET(HP)
  3142. IF stat THEN 'error
  3143. This routine is automatically called by the network lock routines.
  3144. See: FlushKHXBsrc  LockKeyXB
  3145. ~FlushKHXBsrc
  3146. Func: FlushKHXB        Pack: HandlePack         Func:  25/Mid-level
  3147. DIM HP AS HandlePack
  3148. HP.Func = FlushKHXB             'defined in BULLET.BI
  3149. HP.Handle = indexhandle         'handle of file you want to flush
  3150. stat = BULLET(HP)
  3151. IF stat THEN 'error
  3152. Note that the physical write to disk is performed only if the file has changed
  3153. since the open or last flush.
  3154. This routine is automatically called by the network unlock routines.
  3155. See: CopyKHXBsrc  UnlockKeyXB
  3156. ~CopyKHXBsrc
  3157. Func: CopyKHXBsrc      Pack: CopyPack           Func:  26/Mid-level
  3158. DIM CP AS CopyPack
  3159. DIM TempStr AS STRING * 80      'used as fixed-length string for VARPTR()
  3160. TempStr = filename$ + CHR$(0)   'assign filename to a fixed-len string...
  3161. CP.Func = CopyKHXB              'defined in BULLET.BI
  3162. CP.Handle = indexhandle         'handle of file to copy from (the source)
  3163. CP.FilenamePtrOff = VARPTR(TempStr) 'far pointer to filenameZ for copy
  3164. CP.FilenamePtrSeg = VARPTR(TempStr) '(the destination)
  3165. stat = BULLET(CP)
  3166. IF stat THEN 'error
  3167. See: ZapKHXBsrc
  3168. ~ZapKHXBsrc
  3169. Func: ZapKHXB          Pack: HandlePack         Func:  27/Mid-level
  3170. DIM HP AS HandlePack
  3171. HP.Func = ZapKHXB               'defined in BULLET.BI
  3172. HP.Handle = indexhandle         'handle of file you want !ZAP!
  3173. stat = BULLET(HP)
  3174. IF stat THEN 'error
  3175. Note that this removes ALL keys from the index file.
  3176. See: GetDescriptorXBsrc
  3177. ~GetDescriptorXBsrc
  3178. Func: GetDescriptorXB  Pack: DescriptorPack     Func:  30/Mid-level
  3179. DIM DP AS DescriptorPack
  3180. DP.Func = GetDescriptorXB               'defined in BULLET.BI
  3181. DP.Handle = datahandle                  'handle of file
  3182. IF FieldNumber > 0 THEN
  3183.    DP.FieldNumber = FieldNumber         'field number to get info on
  3184. ELSE                                    'or, if 0, then
  3185.    DP.FieldNumber = 0
  3186.    DP.FD.FieldName = fieldname$ + STRING$(10,0)   'fieldname$ to get info on
  3187. ENDIF
  3188. stat = BULLET(DP)
  3189. IF stat = 0 THEN
  3190.    'DP.FD.FieldName is set to field name
  3191.    'DP.FD.FieldType is set to field type
  3192.    'DP.FD.FieldLen is set to field length
  3193.    'DP.FD.FieldDC is set to field DC
  3194. ELSE         
  3195.    'error    
  3196. The DP.FD.FieldLen (and DP.FD.FieldDC) is a byte string so you 
  3197.              
  3198. need to use a FldLen=ASC(DP.FD.FieldLen) for its integer value 
  3199.              
  3200. See: GetRecordXBsrc
  3201. ~GetRecordXBsrc
  3202. Func: GetRecordXB      Pack: AccessPack         Func:  31/Mid-level
  3203. TYPE RecordTYPE                 'simple DBF record layout
  3204. tag AS STRING * 1  <
  3205. code AS STRING * 4     
  3206. THE FIRST BYTE OF YOUR RECORD TYPES MUST BE TAG! 
  3207. bday AS STRING * 8     
  3208. END TYPE
  3209. DIM RecBuff AS RecordTYPE       'record has 2 fields, code/C/4.0, bday/D/8.0
  3210. DIM AP AS AccessPack
  3211. AP.Func = GetRecordXB           'defined in BULLET.BI
  3212. AP.Handle = datahandle          'handle to get record from
  3213. AP.RecNo = RecnoToGet&          'record number to get
  3214. AP.RecPtrOff = VARPTR(RecBuff)  'read record from disk into RecBuff
  3215. AP.RecPtrSeg = VARSEG(RecBuff)
  3216. stat = BULLET(AP)
  3217. IF stat = 0 THEN
  3218.    PRINT RecBuff.code ; ", " ; RecBuff.bday     'sample output: 4321, 19331122
  3219.    'error
  3220. See: AddRecordXBsrc
  3221. ~AddRecordXBsrc
  3222. Func: AddRecordXB      Pack: AccessPack         Func:  32/Mid-level
  3223. TYPE RecordTYPE                 'simple DBF record layout
  3224. tag AS STRING * 1  <
  3225. code AS STRING * 4     
  3226. THE FIRST BYTE OF YOUR RECORD TYPES MUST BE TAG! 
  3227. bday AS STRING * 8     
  3228. END TYPE
  3229. DIM RecBuff AS RecordTYPE       'record has 2 fields, code/C/4.0, bday/D/8.0
  3230. DIM AP AS AccessPack
  3231. 'be sure to init the tag field to a space (ASCII 32)
  3232. RecBuff.tag = " " : RecBuff.code = "1234" : RecBuff.bday = "19331122"
  3233. AP.Func = AddRecordXB           'defined in BULLET.BI
  3234. AP.Handle = datahandle          'handle to add record to
  3235. AP.RecPtrOff = VARPTR(RecBuff)  'write record from RecBuff to disk...
  3236. AP.RecPtrSeg = VARSEG(RecBuff)  '...at next available record number
  3237. stat = BULLET(AP)
  3238. IF stat = 0 THEN
  3239.    PRINT "Record number used by AddRecordXB was "; AP.RecNo
  3240. ELSE 'error
  3241. See: UpdateRecordXBsrc
  3242. ~UpdateRecordXBsrc
  3243. Func: UpdateRecordXB   Pack: AccessPack         Func:  33/Mid-level
  3244. 'see GetRecordXBsrc for this source example's preliminary code
  3245. AP.Func = GetRecordXB           'first get the record to update
  3246. AP.Handle = datahandle
  3247. AP.RecNo = RecnoToGet&          '
  3248. AP.RecPtrOff = VARPTR(RecBuff)  '
  3249.  Do NOT use UpdateRecordXB to change   
  3250. AP.RecPtrSeg = VARSEG(RecBuff)  '
  3251.  any field(s) used in a key expression.
  3252. stat = BULLET(AP)               '
  3253.  Instead use UpdateXB.                 
  3254. IF stat = 0 THEN                '
  3255.    RecBuff.dbay = "19591122"    'change only non-key portions of record
  3256.    AP.Func = UpdateRecordXB     'defined in BULLET.BI
  3257.    stat = BULLET(AP)            'other AP. values are already set from the Get
  3258.    IF stat THEN                 'though you should reassign AP.RecPtrOff/Seg if
  3259.       'error                    'you perform any BASIC string functions between
  3260. 'BULLET calls (none were in this case).
  3261. NOTE: QB/PDS will move strings
  3262. '--by this I mean to set these again
  3263. after a user-break/Ctrl-Break 
  3264. '  AP.RecPtrOff = VARPTR(RecBuff)
  3265. in the QB/QBX environment !!! 
  3266. '  AP.RecPtrSeg = VARSEG(RecBuff)
  3267. '  stat = BULLET(AP) 'do the update call
  3268. See: DeleteRecordXBsrc  UpdateXB
  3269. ~DeleteRecordXBsrc
  3270. Func: DeleteRecordXB   Pack: AccessPack         Func:  34/Mid-level
  3271. DIM AP AS AccessPack
  3272. AP.Func = DeleteRecordXB        'defined in BULLET.BI
  3273. AP.Handle = datahandle          'handle of record to delete
  3274. AP.RecNo = RecnoToDelete&       'to determine which record number any record
  3275. stat = BULLET(AP)               'is, use one of the keyed access routines
  3276. IF stat THEN 'error
  3277. See: UndeleteRecordsrc (XB)
  3278. ~UndeleteRecordsrc (XB)
  3279. Func: UndeleteRecordXB Pack: AccessPack         Func:  35/Mid-level
  3280. DIM AP AS AccessPack
  3281. AP.Func = UndeleteRecordXB      'defined in BULLET.BI
  3282. AP.Handle = datahandle          'handle of record to undelete
  3283. AP.RecNo = RecnoToUndelete&     'to determine which record number any record
  3284. stat = BULLET(AP)               'is use one of the keyed access routines
  3285. IF stat THEN 'error
  3286. See: PackRecordsXBsrc
  3287. ~PackRecordsXBsrc
  3288. Func: PackRecordsXB    Pack: AccessPack         Func:  36/Mid-level
  3289. DIM AP AS AccessPack
  3290. AP.Func = PackRecordsXB         'defined in BULLET.BI
  3291. AP.Handle = datahandle          'handle of data file to pack
  3292. stat = BULLET(AP)
  3293. IF stat THEN 'error
  3294. See: FirstKeyXBsrc
  3295. ~FirstKeyXBsrc
  3296. Func: FirstKeyXB       Pack: AccessPack         Func:  40/Mid-level
  3297. DIM AP AS AccessPack
  3298. DIM TempStr AS STRING * 64      'used as fixed-length string for VARPTR()
  3299.                                 'needs to be at least key length (MAXKEYLEN=64)
  3300. AP.Func = FirstKeyXB            'defined in BULLET.BI
  3301. AP.Handle = indexhandle         'handle to index file to access key from
  3302. AP.KeyPtrOff = VARPTR(TempStr)  'far pointer to key buffer
  3303. AP.KeyPtrSeg = VARSEG(TempStr)  '(the first key is read from disk and put here)
  3304. stat = BULLET(AP)
  3305. IF stat = 0 THEN
  3306.    'TempStr is filled in with the key (for as many bytes as the key length)
  3307.    'so, if the key is a character type, you could PRINT LEFT$(TempStr,KeyLen)
  3308.    'or, if key is a 32-bit LONG then PRINT CVL(LEFT$(TempStr,4)). When using
  3309.    'the key returned, be aware that if UNIQUE was NOT specified then the
  3310.    'enumerator word is attached to the end of the key (the right two bytes).
  3311.    'Also, AP.RecNo is set to the record number of the first key in the index.
  3312.    'error
  3313. See: EqualKeyXBsrc
  3314. ~EqualKeyXBsrc
  3315. Func: EqualKeyXB       Pack: AccessPack         Func:  41/Mid-level
  3316. DIM AP AS AccessPack
  3317. DIM TempStr AS STRING * 64      'used as fixed-length string for VARPTR()
  3318.                                 'passed key to find, start with enum=0
  3319. TempStr = FindKey$ + CHR$(0) + CHR$(0) + CHR$(0) '2 enumerator bytes + 0-term
  3320. AP.Func = EqualKeyXB            'defined in BULLET.BI
  3321. AP.Handle = indexfile           'handle to index file to find key from
  3322. AP.KeyPtrOff = VARPTR(TempStr)  'far pointer to key buffer
  3323. AP.KeyPtrSeg = VARSEG(TempStr)
  3324. stat = BULLET(AP)
  3325. IF stat = 0 THEN
  3326.    'the key matched exactly (including enumerator, if present)
  3327.    'TempStr is NOT ALTERED
  3328.    'AP.RecNo is set to the record number of that key
  3329. ELSEIF stat = 200 THEN
  3330.    AP.Func = NextKeyXB          'if not found, get following key and check the
  3331.    stat = BULLET(AP)            'key proper (key less the enumerator bytes)
  3332.    IF stat = 0 THEN             '(i.e., it may be proper key but enumerator=1)
  3333.       'see NextKeyXBsrc for continuation
  3334. See: NextKeyXBsrc
  3335. ~NextKeyXBsrc
  3336. Func: NextKeyXB        Pack: AccessPack         Func:  42/Mid-level
  3337. 'see EqualKeyXBsrc for preliminary code
  3338. AP.Func = NextKeyXB             'defined in BULLET.BI
  3339. stat = BULLET(AP)               'KEYLEN assumed to equal actual key length...
  3340. IF stat = 0 THEN                '...as returned by StatKXB
  3341.     IF IndexFileIsNotUnique THEN
  3342.        IF LEFT$(TempStr,KeyLen-2) = FindKey$ THEN 'the next key matches!
  3343.                                                   '(except for the enumerator)
  3344. This code example follows up on the EqualKeyXBsrc example. See EqualKeyXB for
  3345. more information on finding partial keys.
  3346. See: PrevKeyXBsrc  EqualKeyXBsrc
  3347. ~PrevKeyXBsrc
  3348. Func: PrevKeyXB        Pack: AccessPack         Func:  43/Mid-level
  3349. DIM AP AS AccessPack
  3350. DIM TempStr AS STRING * 64      'used as fixed-length string for VARPTR()
  3351. 'assume code has already executed to locate a key--this code then gets the key
  3352. 'before that one
  3353. AP.Func = PrevKeyXB             'defined in BULLET.BI
  3354. AP.Handle = indexfile           'handle to index file to access key from
  3355. AP.KeyPtrOff = VARPTR(TempStr)  'far pointer to key buffer
  3356. AP.KeyPtrSeg = VARSEG(TempStr)  '(the prev key is read from disk and put here)
  3357. stat = BULLET(AP)
  3358. IF stat = 0 THEN
  3359.    'TempStr is filled in with the key (for as many bytes as the key length).
  3360.    'Also, AP.RecNo is set to the record number of the key.
  3361.    'error
  3362. See: LastKeyXBsrc
  3363. ~LastKeyXBsrc
  3364. Func: LastKeyXB        Pack: AccessPack         Func:  44/Mid-level
  3365. DIM AP AS AccessPack
  3366. DIM TempStr AS STRING * 64      'used as fixed-length string for VARPTR()
  3367. AP.Func = LastKeyXB             'defined in BULLET.BI
  3368. AP.Handle = indexfile           'handle to index file to access key from
  3369. AP.KeyPtrOff = VARPTR(TempStr)  'far pointer to key buffer
  3370. AP.KeyPtrSeg = VARSEG(TempStr)  '(the last key is read from disk and put here)
  3371. stat = BULLET(AP)
  3372. IF stat = 0 THEN
  3373.    'TempStr is filled in with the key (for as many bytes as the key length)
  3374.    'AP.RecNo is set to the record number of the last key.
  3375.    'error
  3376. See: StoreKeyXBsrc
  3377. ~StoreKeyXBsrc
  3378. Func: StoreKeyXB       Pack: AccessPack         Func:  45/Mid-level
  3379. DIM AP AS AccessPack
  3380. DIM TempStr AS STRING * 64      'used as fixed-length string for VARPTR()
  3381. 'Assume record has been added to data file (AddRecordXB, returning RecNo2Use)
  3382. 'and key has been built (BuildKeyXB returning KeyToAdd$).
  3383.               
  3384. TempStr = KeyToAdd$ + CHR$(0)   'add the key to a UNIQUE index file
  3385. AP.Func = StoreKeyXB            'defined in BULLET.BI
  3386. AP.Handle = indexfile           'handle to index file to insert key into
  3387. AP.RecNo = RecNo2Use            'associate this record number with key
  3388. AP.KeyPtrOff = VARPTR(TempStr)  'far pointer to key buffer
  3389. AP.KeyPtrSeg = VARSEG(TempStr)  '(the last key is read from disk and put here)
  3390. stat = BULLET(AP)
  3391. IF stat = 0 THEN
  3392.    'key added
  3393. ELSEIF stat = 201 THEN
  3394.    'key already exists, which means you need to construct a unique enumerator--
  3395.    'provided the file wasn't created for UNIQUE keys...INSTEAD USE InsertXB!
  3396. See: DeleteKeyXBsrc  InsertXB
  3397. ~DeleteKeyXBsrc
  3398. Func: DeleteKeyXB      Pack: AccessPack         Func:  46/Mid-level
  3399. DIM AP AS AccessPack
  3400. DIM TempStr AS STRING * 64      'used as fixed-length string for VARPTR()
  3401. TempStr = KeyToDelete$ + CHR$(0)   'delete the key from a UNIQUE index file
  3402.                                    '(else need to supply enumerator also)
  3403. AP.Func = DeleteKeyXB           'defined in BULLET.BI
  3404. AP.Handle = indexfile           'handle to index file of key to delete
  3405. AP.KeyPtrOff = VARPTR(TempStr)  'far pointer to key buffer
  3406. AP.KeyPtrSeg = VARSEG(TempStr)  '(this key is searched for exactly)
  3407. stat = BULLET(AP)               'if exact match found the key is deleted!
  3408. IF stat = 0 THEN
  3409.    'key deleted permanently
  3410. ELSEIF stat = 200 THEN
  3411.    'key as stated was not in the index file--if the index is not UNQIUE then
  3412.    'you must supply the exact enumerator along with the key proper to delete
  3413.    '--you can use the CurrentKeyXB routine to obtain the exact current key
  3414.    'other error
  3415. See: BuildKeyXBsrc
  3416. ~BuildKeyXBsrc
  3417. Func: BuildKeyXB       Pack: AccessPack         Func:  47/Mid-level
  3418. DIM AP AS AccessPack
  3419. DIM TempStr AS STRING * 64      'used as fixed-length string for VARPTR()
  3420. 'Assume record has been built and is ready to be added to the data file. The
  3421. 'record is in the variable RecBuff (a fixed-length TYPE variable, typically).
  3422. AP.Func = BuildKeyXB            'defined in BULLET.BI
  3423. AP.Handle = indexfile           'handle to index file key is to be built for
  3424. AP.RecPtrOff = VARPTR(RecBuff)  'far pointer to data record buffer
  3425. AP.RecPtrSeg = VARSEG(RecBuff)
  3426. AP.KeyPtrOff = VARPTR(TempStr)  'far pointer to key buffer
  3427. AP.KeyPtrSeg = VARSEG(TempStr)  '(the built key is put here)
  3428. stat = BULLET(AP)
  3429. IF stat = 0 THEN
  3430.    'key built okay so can do a AddRecordXB followed by a StoreKeyXB
  3431.    'but, again, InsertXB takes care of all this detail and then some--use it
  3432.    'error
  3433. See: CurrentKeyXBsrc
  3434. ~CurrentKeyXBsrc
  3435. Func: CurrentKeyXB     Pack: AccessPack         Func:  48/Mid-level
  3436. DIM AP AS AccessPack
  3437. DIM TempStr AS STRING * 64      'used as fixed-length string for VARPTR()
  3438. AP.Func = CurrentKeyXB          'defined in BULLET.BI
  3439. AP.Handle = indexfile           'handle to index file
  3440. AP.KeyPtrOff = VARPTR(TempStr)  'far pointer to key buffer
  3441. AP.KeyPtrSeg = VARSEG(TempStr)  '(the current key is put here)
  3442. stat = BULLET(AP)
  3443. IF stat = 0 THEN
  3444.    'TempStr set to current key (valid only for KeyLen bytes)
  3445.    'Also, AP.RecNo is set to the record number of the key.
  3446.    'error
  3447. See: GetFirstXBsrc
  3448. ~GetFirstXBsrc
  3449. Func: GetFirstXB       Pack: AccessPack         Func:  60/High-level
  3450. DIM AP AS AccessPack
  3451. DIM TempStr AS STRING * 64      'used as fixed-length string for VARPTR()
  3452. DIM RecBuff AS RecordTYPE       'see AddRecordXBsrc for record layout
  3453. AP.Func = GetFirstXB            'defined in BULLET.BI
  3454. AP.Handle = indexhandle         'handle to index file to access key from
  3455. AP.RecPtrOff = VARPTR(RecBuff)  'far pointer to record buffer
  3456. AP.RecPtrSeg = VARSEG(RecBuff)  '(the record indexed by the key is put here)
  3457. AP.KeyPtrOff = VARPTR(TempStr)  'far pointer to key buffer
  3458. AP.KeyPtrSeg = VARSEG(TempStr)  '(the first key is read from disk and put here)
  3459. stat = BULLET(AP)
  3460. IF stat = 0 THEN
  3461.    'TempStr is filled in with the key (for as many bytes as the key length)
  3462.    'RecBuff is filled in with the data record
  3463.    'AP.RecNo is set to the record number of the first key in the index.
  3464.    'error
  3465. See: GetEqualXBsrc
  3466. ~GetEqualXBsrc
  3467. Func: GetEqualXB       Pack: AccessPack         Func:  61/High-level
  3468. DIM AP AS AccessPack
  3469. DIM TempStr AS STRING * 64      'used as fixed-length string for VARPTR()
  3470. DIM RecBuff AS RecordTYPE       'see AddRecordXBsrc for record layout
  3471.                                 'passed key to find, start with enum=0
  3472. TempStr = FindKey$ + CHR$(0) + CHR$(0) + CHR$(0) '2 enumerator bytes + 0-term
  3473. AP.Func = GetEqualXB            'defined in BULLET.BI
  3474. AP.Handle = indexfile           'handle to index file to find key from
  3475. AP.RecPtrOff = VARPTR(RecBuff)  'far pointer to record buffer
  3476. AP.RecPtrSeg = VARSEG(RecBuff)  '(the record indexed by the key is put here)
  3477. AP.KeyPtrOff = VARPTR(TempStr)  'far pointer to key buffer
  3478. AP.KeyPtrSeg = VARSEG(TempStr)
  3479. stat = BULLET(AP)
  3480. IF stat = 0 THEN
  3481.    'RecBuff, and AP.RecNo filled as expected (TempStr remains the same)
  3482. ELSEIF stat = 200 THEN
  3483.    AP.Func = GetNextXB          'if not found, can get following key--the next
  3484.    stat = BULLET(AP)            'key would logically follow the key not found
  3485.                                 '--this let's you search based on partial keys
  3486. See: GetNextXBsrc
  3487. ~GetNextXBsrc
  3488. Func: GetNextXB        Pack: AccessPack         Func:  62/High-level
  3489. DIM AP AS AccessPack
  3490. DIM TempStr AS STRING * 64      'used as fixed-length string for VARPTR()
  3491. DIM RecBuff AS RecordTYPE       'see AddRecordXBsrc for record layout
  3492. AP.Func = GetFirstXB            'defined in BULLET.BI
  3493. AP.Handle = indexhandle         'handle to index file to access key from
  3494. AP.RecPtrOff = VARPTR(RecBuff)  'far pointer to record buffer
  3495. AP.RecPtrSeg = VARSEG(RecBuff)  '(the record indexed by the key is put here)
  3496. AP.KeyPtrOff = VARPTR(TempStr)  'far pointer to key buffer
  3497. AP.KeyPtrSeg = VARSEG(TempStr)  '(the first key is read from disk and put here)
  3498. stat = BULLET(AP)
  3499. DO WHILE stat = 0               'print all records in key order
  3500.    PRINT AP.RecNo; RecBuff.code; ", "; RecBuff.bday
  3501.    AP.Func = GetNextXB
  3502.    stat = BULLET(AP)
  3503. IF stat <> 202 THEN             'error 202 means end of file (expected)
  3504.    'error other than expected EOF
  3505. See: GetPrevXBsrc
  3506. ~GetPrevXBsrc
  3507. Func: GetPrevXB        Pack: AccessPack         Func:  63/High-level
  3508. DIM AP AS AccessPack
  3509. DIM TempStr AS STRING * 64      'used as fixed-length string for VARPTR()
  3510. DIM RecBuff AS RecordTYPE       'see AddRecordXBsrc for record layout
  3511. AP.Func = GetLastXB             'defined in BULLET.BI
  3512. AP.Handle = indexhandle         'handle to index file to access key from
  3513. AP.RecPtrOff = VARPTR(RecBuff)  'far pointer to record buffer
  3514. AP.RecPtrSeg = VARSEG(RecBuff)  '(the record indexed by the key is put here)
  3515. AP.KeyPtrOff = VARPTR(TempStr)  'far pointer to key buffer
  3516. AP.KeyPtrSeg = VARSEG(TempStr)  '(the last key is read from disk and put here)
  3517. stat = BULLET(AP)
  3518. DO WHILE stat = 0               'print all records in REVERSE key order
  3519.    PRINT AP.RecNo; RecBuff.code; ", "; RecBuff.bday
  3520.    AP.Func = GetPrevXB
  3521.    stat = BULLET(AP)
  3522. IF stat <> 203 THEN             'error 203 means top of file (expected)
  3523.    'error other than expected TOF
  3524. See: GetLastXBsrc
  3525. ~GetLastXBsrc
  3526. Func: GetLastXB        Pack: AccessPack         Func:  64/High-level
  3527. DIM AP AS AccessPack
  3528. DIM TempStr AS STRING * 64      'used as fixed-length string for VARPTR()
  3529. DIM RecBuff AS RecordTYPE       'see AddRecordXBsrc for record layout
  3530. AP.Func = GetLastXB             'defined in BULLET.BI
  3531. AP.Handle = indexhandle         'handle to index file to access key from
  3532. AP.RecPtrOff = VARPTR(RecBuff)  'far pointer to record buffer
  3533. AP.RecPtrSeg = VARSEG(RecBuff)  '(the record indexed by the key is put here)
  3534. AP.KeyPtrOff = VARPTR(TempStr)  'far pointer to key buffer
  3535. AP.KeyPtrSeg = VARSEG(TempStr)  '(the last key is read from disk and put here)
  3536. stat = BULLET(AP)
  3537. IF stat = 0 THEN
  3538.    'TempStr is filled in with the key (for as many bytes as the key length)
  3539.    'RecBuff is filled in with the data record
  3540.    'AP.RecNo is set to the record number of the last key in the index.
  3541.    'error
  3542. See: InsertXBsrc
  3543. ~InsertXBsrc
  3544. Func: InsertXB         Pack: AccessPack         Func:  65/High-level
  3545. REDIM AP(1 TO 4) AS AccessPack  'array of 3 access packs, 1 for each index file
  3546.                                 'TempStr and RecBuff previously defined
  3547. FOR i = 1 TO 3                  '3=number of related indexes to maintain
  3548.    AP(i).Func = InsertXB
  3549.    AP(i).Handle = indexhandle(i)          'each index file's handle
  3550.    AP(i).RecPtrOff = VARPTR(RecBuff) 
  3551.    AP(i).RecPtrSeg = VARSEG(RecBuff) 
  3552.  see AddRecordXBsrc for RecBuff TYPE 
  3553.    AP(i).KeyPtrOff = VARPTR(TempStr) 
  3554. (be sure you reserved the tag field) 
  3555.    AP(i).KeyPtrSeg = VARSEG(TempStr) 
  3556.    AP(i).NextPtrOff = VARPTR(AP(i + 1))   'point to NEXT access pack
  3557.    AP(i).NextPtrSeg = VARSEG(AP(i + 1))   'AP(1 TO 4) to avoid subscript error
  3558. AP(3).NextPtrOff = 0            'reset last access pack to end-link value
  3559. AP(3).NextPtrSeg = 0
  3560. stat = BULLET(AP(1))
  3561. IF stat = 0 THEN                'if stat=0 must still check AP(1).Stat
  3562.    IF AP(1).Stat <> 0 THEN      'error when adding data record
  3563.    TrueError = AP(stat).Stat    'the returned stat is array index of bad pack
  3564. See: UpdateXBsrc
  3565. ~UpdateXBsrc
  3566. Func: UpdateXB         Pack: AccessPack         Func:  66/High-level
  3567. REDIM AP(1 TO 4) AS AccessPack  'array of 3 access packs, 1 for each index file
  3568.                                 'TempStr and RecBuff previously defined
  3569. FOR i = 1 TO 3                  '3=number of related indexes to maintain
  3570.    AP(i).Func = UpdateXB
  3571.    AP(i).Handle = indexhandle(i)          'each index file's handle
  3572.    AP(i).RecNo = RecordNumberToUpdate&    'tell it which record to update
  3573.    AP(i).RecPtrOff = VARPTR(RecBuff)      'RecBuff has new, updated data
  3574.    AP(i).RecPtrSeg = VARSEG(RecBuff)
  3575.    AP(i).KeyPtrOff = VARPTR(TempStr)
  3576.    AP(i).KeyPtrSeg = VARSEG(TempStr)
  3577.    AP(i).NextPtrOff = VARPTR(AP(i + 1))   'point to NEXT access pack
  3578.    AP(i).NextPtrSeg = VARSEG(AP(i + 1))   'AP(1 TO 4) to avoid subscript error
  3579. AP(3).NextPtrOff = 0 : AP(3).NextPtrSeg = 0 'reset last access pack to 0
  3580. stat = BULLET(AP(1))
  3581. IF stat = 0 THEN                'if stat=0 must still check AP(1).Stat
  3582.    IF AP(1).Stat <> 0 THEN      'error when writing data record
  3583.    TrueError = AP(stat).Stat    'the returned stat is array index of bad pack
  3584. See: ReindexXBsrc
  3585. ~ReindexXBsrc
  3586. Func: ReindexXB        Pack: AccessPack         Func:  67/High-level
  3587. REDIM AP(1 TO 4) AS AccessPack  'array of 3 access packs, 1 for each index file
  3588.                                 'DIM'd to 4 to avoid bad subscript in loop
  3589. FOR i = 1 TO 3                  '3=number of related indexes to reindex
  3590.    AP(i).Func = ReindexXB
  3591.    AP(i).Handle = indexhandle(i)          'each index file's handle
  3592.    AP(i).NextPtrOff = VARPTR(AP(i + 1))   'point to NEXT access pack
  3593.    AP(i).NextPtrSeg = VARSEG(AP(i + 1))   'AP(1 TO 4) to avoid subscript error
  3594. AP(3).NextPtrOff = 0
  3595. AP(3).NextPtrSeg = 0            'reset last access pack to end-link value
  3596. stat = BULLET(AP(1))
  3597. IF stat THEN                    'if stat <> 0 then the...
  3598.    TrueError = AP(stat).Stat    '...returned stat is array index of bad pack
  3599. The reason AP() is REDIM AP(1 TO 4) is so that the AP(i + 1) in the code loop
  3600. doesn't create an invalid subscript error.                                   
  3601. See: LockXBsrc
  3602. ~LockXBsrc
  3603. Func: LockXB           Pack: AccessPack         Func:  80/Network
  3604. REDIM AP(1 TO 4) AS AccessPack  'array of 3 access packs, 1 for each index file
  3605.                                 'DIM'd to 4 to avoid bad subscript in loop
  3606. FOR i = 1 TO 3                  '3=number of related indexes to Lock
  3607.    AP(i).Func = LockXB
  3608.    AP(i).Handle = indexhandle(i)          'each index file's handle
  3609.    AP(i).NextPtrOff = VARPTR(AP(i + 1))   'point to NEXT access pack
  3610.    AP(i).NextPtrSeg = VARSEG(AP(i + 1))
  3611. NEXT                            'data file handle known internally by BULLET
  3612. AP(3).NextPtrOff = 0
  3613. AP(3).NextPtrSeg = 0            'reset last access pack to end-link value
  3614. stat = BULLET(AP(1))
  3615. IF stat > 3 THEN                'if stat > 3 (> number of packs) then the...
  3616.    TrueError = AP(3).Stat       '...lock failed on the data file
  3617. ELSEIF stat <> 0 THEN                                          (|last ReadKHXB)
  3618.    TrueError = AP(stat).Stat    '...lock failed on index file # stat
  3619. The Lock routines use a different method to identify the bad pack when the   
  3620. failure was caused by the data file. See above.                              
  3621. See: UnlockXBsrc
  3622. ~UnlockXBsrc
  3623. Func: UnlockXB         Pack: AccessPack         Func:  81/Network
  3624. REDIM AP(1 TO 4) AS AccessPack  'array of 3 access packs, 1 for each index file
  3625.                                 'DIM'd to 4 to avoid bad subscript in loop
  3626. FOR i = 1 TO 3                  '3=number of related indexes to Lock
  3627.    AP(i).Func = UnlockXB
  3628.    AP(i).Handle = indexhandle(i)          'each index file's handle
  3629.    AP(i).NextPtrOff = VARPTR(AP(i + 1))   'point to NEXT access pack
  3630.    AP(i).NextPtrSeg = VARSEG(AP(i + 1))
  3631. NEXT                            'data file handle known internally by BULLET
  3632. AP(3).NextPtrOff = 0
  3633. AP(3).NextPtrSeg = 0            'reset last access pack to end-link value
  3634. stat = BULLET(AP(1))
  3635. IF stat > 3 THEN                'if stat > 3 (> number of packs) then the...
  3636.    TrueError = AP(3).Stat       '...unlock failed on the data file
  3637. ELSEIF stat <> 0 THEN
  3638.    TrueError = AP(stat).Stat    '...unlock failed on index file # stat
  3639. The Lock routines use a different method to identify the bad pack when the   
  3640. failure was caused by the data file. See above.                              
  3641. See: LockKeyXBsrc
  3642. ~LockKeyXBsrc
  3643. Func: LockKeyXB        Pack: AccessPack         Func:  82/Network
  3644. REDIM AP(1 TO 4) AS AccessPack  'array of 3 access packs, 1 for each index file
  3645.                                 'DIM'd to 4 to avoid bad subscript in loop
  3646. FOR i = 1 TO 3                  '3=number of related indexes to Lock
  3647.    AP(i).Func = LockXB
  3648.    AP(i).Handle = indexhandle(i)          'each index file's handle
  3649.    AP(i).NextPtrOff = VARPTR(AP(i + 1))   'point to NEXT access pack
  3650.    AP(i).NextPtrSeg = VARSEG(AP(i + 1))
  3651. AP(3).NextPtrOff = 0
  3652. AP(3).NextPtrSeg = 0            'reset last access pack to end-link value
  3653. stat = BULLET(AP(1))
  3654. IF stat <> 0 THEN
  3655.    TrueError = AP(stat).Stat    'lock failed on index file # stat
  3656.                                 '--if stat > 3 then failed on last internal
  3657.                                 '--ReadKHXB...This is EXTREMELY unlikely
  3658. See: UnlockKeyXBsrc
  3659. ~UnlockKeyXBsrc
  3660. Func: UnlockKeyXB      Pack: AccessPack         Func:  83/Network
  3661. REDIM AP(1 TO 4) AS AccessPack  'array of 3 access packs, 1 for each index file
  3662.                                 'DIM'd to 4 to avoid bad subscript in loop
  3663. FOR i = 1 TO 3                  '3=number of related indexes to Lock
  3664.    AP(i).Func = UnlockKeyXB
  3665.    AP(i).Handle = indexhandle(i)          'each index file's handle
  3666.    AP(i).NextPtrOff = VARPTR(AP(i + 1))   'point to NEXT access pack
  3667.    AP(i).NextPtrSeg = VARSEG(AP(i + 1))
  3668. AP(3).NextPtrOff = 0
  3669. AP(3).NextPtrSeg = 0            'reset last access pack to end-link value
  3670. stat = BULLET(AP(1))
  3671. IF stat <> 0 THEN
  3672.    TrueError = AP(stat).Stat    'unlock failed on index file # stat
  3673. See: LockDataXBsrc
  3674. ~LockDataXBsrc
  3675. Func: LockDataXB       Pack: AccessPack         Func:  84/Network
  3676. DIM AP AS AccessPack
  3677. AP.Func = LockDataXB            'defined in BULLET.BI
  3678. AP.Handle = datahandle          'handle of data file to lock
  3679. AP.RecNo = 0&                   '=0 to lock all or, set to actual record number
  3680. stat = BULLET(AP)               '   to lock as in AP.RecNo = lockThisRec&
  3681. IF stat THEN 'error
  3682. See: UnlockDataXBsrc
  3683. ~UnlockDataXBsrc
  3684. Func: UnlockDataXB     Pack: AccessPack         Func:  85/Network
  3685. DIM AP AS AccessPack
  3686. AP.Func = UnlockDataXB          'defined in BULLET.BI
  3687. AP.Handle = datahandle          'handle of data file to unlock
  3688. AP.RecNo = 0&                   '=0 to unlock all or, set to actual record num
  3689. stat = BULLET(AP)               '   to unlock as in AP.RecNo = lockThisRec&
  3690. IF stat THEN 'error
  3691.                                 'note: you cannot unlock parts of a file with
  3692.                                 '1 single unlock (where AP.RecNo=0). Instead,
  3693.                                 'you must unlock each record individually--
  3694.                                 'that is, if you made any single-record locks
  3695. See: DriveRemoteXBsrc
  3696. ~DriveRemoteXBsrc
  3697. Func: DriveRemoteXB    Pack: RemotePack         Func:  86/Network
  3698. DIM RP AS RemotePack
  3699. RP.Func = DriveRemoteXB         'defined in BULLET.BI
  3700. RP.Handle = drive2check         'drive to check (0=default, 1=A:,2=B:,3=C:...)
  3701. stat = BULLET(RP)
  3702. IF stat = 0 THEN
  3703.    'RP.IsRemote set to 0 if drive local, 1 if remote
  3704.    'RP.Flags set to DX register as returned by DOS
  3705.    'RP.IsShare set to 0 if SHARE.EXE is not loaded, non-zero SHARE installed
  3706.   'error  (like invalid drive)
  3707. See: FileRemoteXBsrc
  3708. ~FileRemoteXBsrc
  3709. Func: FileRemoteXB     Pack: RemotePack         Func:  87/Network
  3710. DIM RP AS RemotePack
  3711. RP.Func = FileRemoteXB          'defined in BULLET.BI
  3712. RP.Handle = filehandle          'file handle to check
  3713. stat = BULLET(RP)
  3714. IF stat = 0 THEN
  3715.    'RP.IsRemote set to 0 if file local, 1 if remote
  3716.    'RP.Flags set to DX register as returned by DOS
  3717.    'RP.IsShare set to 0 if SHARE.EXE is not loaded, non-zero SHARE installed
  3718.   'error  (like invalid handle)
  3719. See: SetRetriesXBsrc
  3720. ~SetRetriesXBsrc
  3721. Func: SetRetriesXB     Pack: SetRetriesPack     Func:  88/Network
  3722. DIM SRP AS SetRetriesPack
  3723. SRP.Func = SetRetriesXB
  3724. SRP.Mode = 1             '1=set to user values, 0=set DOS default
  3725. SRP.Pause = 5000         'do 5,000 loops between retries
  3726. SRP.Retries = 5          'try 5 times before giving up with error
  3727. stat = BULLET(SRP)
  3728. IF stat THEN
  3729.    'error                'it's unlikely an error occurs
  3730. See: DeleteFileDOSsrc
  3731. ~DeleteFileDOSsrc
  3732. Func: DeleteFileDOS    Pack: DOSFilePack        Func: 100/DOS
  3733. DIM DFP AS DOSFilePack
  3734. DIM TempStr AS STRING * 80
  3735. TempStr = file2delete$ + CHR$(0)
  3736. DFP.Func = DeleteFileDOS        'defined in BULLET.BI
  3737. DFP.FilenamePtrOff = VARPTR(TempStr)
  3738. DFP.FilenamePtrSeg = VARSEG(TempStr)
  3739. stat = BULLET(DFP)
  3740. IF stat THEN 'error
  3741. See: RenameFileDOSsrc
  3742. ~RenameFileDOSsrc
  3743. Func: RenameFileDOS    Pack: DOSFilePack        Func: 101/DOS
  3744. DIM DFP AS DOSFilePack
  3745. DIM TempStr AS STRING * 80
  3746. DIM TempStr2 AS STRING * 80
  3747. TempStr = file2rename$ + CHR$(0)
  3748. TempStr2 = newfilename$ + CHR$(0)
  3749. DFP.Func = RenameFileDOS        'defined in BULLET.BI
  3750. DFP.FilenamePtrOff = VARPTR(TempStr)
  3751. DFP.FilenamePtrSeg = VARSEG(TempStr)
  3752. DFP.NewNamePtrOff = VARPTR(TempStr2)
  3753. DFP.NewNamePtrSeg = VARSEG(TempStr2)
  3754. stat = BULLET(DFP)
  3755. IF stat THEN 'error
  3756. See: CreateFileDOSsrc
  3757. ~CreateFileDOSsrc
  3758. Func: CreateFileDOS    Pack: DOSFilePack        Func: 102/DOS
  3759. DIM DFP AS DOSFilePack
  3760. DIM TempStr AS STRING * 80
  3761. TempStr = file2create$ + CHR$(0)
  3762. DFP.Func = CreateFileDOS        'defined in BULLET.BI
  3763. DFP.FilenamePtrOff = VARPTR(TempStr)
  3764. DFP.FilenamePtrSeg = VARSEG(TempStr)
  3765. DFP.Attr = 0                    'normal file directory attribute
  3766. stat = BULLET(DFP)
  3767. IF stat THEN 'error
  3768. See: AccessFileDOSsrc
  3769. ~AccessFileDOSsrc
  3770. Func: AccessFileDOS    Pack: DOSFilePack        Func: 103/DOS
  3771. DIM DFP AS DOSFilePack
  3772. DIM TempStr AS STRING * 80
  3773. TempStr = file2access$ + CHR$(0)
  3774. DFP.Func = AccessFileDOS        'defined in BULLET.BI
  3775. DFP.FilenamePtrOff = VARPTR(TempStr)
  3776. DFP.FilenamePtrSeg = VARSEG(TempStr)
  3777. DFP.ASmode = &H42               'attempt R/W DENY NONE access
  3778. stat = BULLET(DFP)
  3779. IF stat THEN 'error
  3780. See: OpenFileDOSsrc
  3781. ~OpenFileDOSsrc
  3782. Func: OpenFileDOS      Pack: DOSFilePack        Func: 104/DOS
  3783. DIM DFP AS DOSFilePack
  3784. DIM TempStr AS STRING * 80
  3785. TempStr = file2open$ + CHR$(0)
  3786. DFP.Func = OpenFileDOS          'defined in BULLET.BI
  3787. DFP.FilenamePtrOff = VARPTR(TempStr)
  3788. DFP.FilenamePtrSeg = VARSEG(TempStr)
  3789. DFP.ASmode = &H42               'open in R/W DENY NONE access
  3790. stat = BULLET(DFP)
  3791. IF stat = 0 THEN
  3792.    'DFP.Handle set to handle of open file
  3793.    'error
  3794. See: SeekFileDOSsrc
  3795. ~SeekFileDOSsrc
  3796. Func: SeekFileDOS      Pack: DOSFilePack        Func: 105/DOS
  3797. DIM DFP AS DOSFilePack
  3798. DFP.Func = SeekFileDOS          'defined in BULLET.BI
  3799. DFP.Handle = handle
  3800. DFP.SeekOffset = 0&             'position 0 relative EOF (get length of file)
  3801. DFP.Method = 2                  'seek from END of file
  3802. stat = BULLET(DFP)
  3803. IF stat = 0 THEN
  3804.    'DFP.SeekOffset set to absolute current offset
  3805.    '--in this case, the DFP.SeekOffset equals then length of the file
  3806.    'error
  3807. See: ReadFileDOSsrc
  3808. ~ReadFileDOSsrc
  3809. Func: ReadFileDOS      Pack: DOSFilePack        Func: 106/DOS
  3810. DIM DFP AS DOSFilePack
  3811. DIM ReadBuff AS STRING * 512    'sector buffer
  3812. DFP.Func = ReadFileDOS          'defined in BULLET.BI
  3813. DFP.Handle = handle
  3814. DFP.Bytes = Bytes2Read          '16-bit value, in this case 512 since that's
  3815. DFP.BufferPtrOff = VARPTR(ReadBuff)            'the size of ReadBuff
  3816. DFP.BufferPtrSeg = VARSEG(ReadBuff)
  3817. stat = BULLET(DFP)
  3818. IF stat = 0 THEN
  3819.    IF DFP.Bytes <> Bytes2Read THEN              'check if EOF processed
  3820.       'hit EOF before reading all 512 bytes
  3821.    ELSE
  3822.       'ReadBuff filled with 512 bytes of data read from the current disk pos
  3823.       'disk position moved to the last byte read + 1
  3824.    ENDIF
  3825.    'error
  3826. See: ExpandFileDOSsrc
  3827. ~ExpandFileDOSsrc
  3828. Func: ExpandFileDOS    Pack: DOSFilePack        Func: 107/DOS
  3829. DIM DFP AS DOSFilePack
  3830. DFP.Func =  ExpandFileDOS       'defined in BULLET.BI
  3831. DFP.Handle = handle
  3832. DFP.SeekOffset = Bytes2ExpandBy&
  3833. stat = BULLET(DFP)
  3834. IF stat = 0 THEN
  3835.    'file expanded by number of bytes specified
  3836.    'error
  3837. See: WriteFileDOSsrc
  3838. ~WriteFileDOSsrc
  3839. Func: WriteFileDOS     Pack: DOSFilePack        Func: 108/DOS
  3840. DIM DFP AS DOSFilePack
  3841. DIM WriteBuff AS STRING * 512   'sector buffer
  3842. DFP.Func = WriteFileDOS         'defined in BULLET.BI
  3843. DFP.Handle = handle
  3844. DFP.Bytes = Bytes2Write         '16-bit value, in this case 512 since that's
  3845. DFP.BufferPtrOff = VARPTR(WriteBuff)           'the size of WriteBuff
  3846. DFP.BufferPtrSeg = VARSEG(WriteBuff)
  3847. stat = BULLET(DFP)
  3848. IF stat = -2 THEN
  3849.    'disk full
  3850. ELSE IF stat THEN
  3851.    'other error
  3852.    'okay
  3853. Unlike ReadFileDOS, if the number of bytes actually written does not equal
  3854. Bytes2Write, the WriteFileDOS routine returns a DISK FULL error code (-2).
  3855. See: CloseFileDOSsrc
  3856. ~CloseFileDOSsrc
  3857. Func: CloseFileDOS     Pack: DOSFilePack        Func: 109/DOS
  3858. DIM DFP AS DOSFilePack
  3859. DFP.Func = CloseFileDOS         'defined in BULLET.BI
  3860. DFP.Handle =handle2close
  3861. stat = BULLET(DFP)
  3862. IF stat THEN 'error
  3863. See: MakeDirDOSsrc
  3864. ~MakeDirDOSsrc
  3865. Func: MakeDirDOS       Pack: DOSFilePack        Func: 110/DOS
  3866. DIM DFP AS DOSFilePack
  3867. DIM TempStr AS STRING * 80
  3868. TempStr = subdir2make$ + CHR$(0)
  3869. DFP.Func = MakeDirDOS           'defined in BULLET.BI
  3870. DFP.FilenamePtrOff = VARPTR(TempStr)
  3871. DFP.FilenamePtrSeg = VARSEG(TempStr)
  3872. stat = BULLET(DFP)
  3873. IF stat THEN 'error
  3874. See: DeleteFileDOSsrc
  3875.